From: Junio C Hamano Date: Wed, 7 Jan 2009 08:10:14 +0000 (-0800) Subject: Merge branch 'rs/diff-ihc' X-Git-Tag: v1.6.2-rc0~183 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/7bb5321be0ecb70a990ad49da2a1366c19201372?ds=inline;hp=-c Merge branch 'rs/diff-ihc' * rs/diff-ihc: diff: add option to show context between close hunks Conflicts: Documentation/diff-options.txt --- 7bb5321be0ecb70a990ad49da2a1366c19201372 diff --combined Documentation/diff-options.txt index b432d2518a,c7fcc8007a..671f533ca3 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@@ -19,12 -19,16 +19,12 @@@ endif::git-format-patch[ ifndef::git-format-patch[] -p:: +-u:: Generate patch (see section on generating patches). {git-diff? This is the default.} endif::git-format-patch[] --u:: - Synonym for "-p". - -U:: - Shorthand for "--unified=". - --unified=:: Generate diffs with lines of context instead of the usual three. Implies "-p". @@@ -186,25 -190,35 +186,29 @@@ can name which subdirectory to make the output relative to by giving a as an argument. +-a:: --text:: Treat all files as text. --a:: - Shorthand for "--text". - --ignore-space-at-eol:: Ignore changes in whitespace at EOL. +-b:: --ignore-space-change:: Ignore changes in amount of whitespace. This ignores whitespace at line end, and considers all other sequences of one or more whitespace characters to be equivalent. --b:: - Shorthand for "--ignore-space-change". - +-w:: --ignore-all-space:: Ignore whitespace when comparing lines. This ignores differences even if one line has whitespace where the other line has none. --w:: - Shorthand for "--ignore-all-space". - + --inter-hunk-context=:: + Show the context between diff hunks, up to the specified number + of lines, thereby fusing hunks that are close to each other. + --exit-code:: Make the program exit with codes similar to diff(1). That is, it exits with 1 if there were differences and diff --combined contrib/completion/git-completion.bash index 3b25d48098,a046441974..8ec782dc54 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@@ -776,6 -776,7 +776,7 @@@ _git_diff ( --no-ext-diff --no-prefix --src-prefix= --dst-prefix= --base --ours --theirs + --inter-hunk-context= " return ;; @@@ -967,6 -968,7 +968,7 @@@ _git_log ( --color-words --walk-reflogs --parents --children --full-history --merge + --inter-hunk-context= " return ;; @@@ -1403,7 -1405,7 +1405,7 @@@ _git_reset ( local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in --*) - __gitcomp "--mixed --hard --soft" + __gitcomp "--merge --mixed --hard --soft" return ;; esac diff --combined diff.c index c159a5fc65,56b80f9609..d23548292a --- a/diff.c +++ b/diff.c @@@ -1469,6 -1469,7 +1469,7 @@@ static void builtin_diff(const char *na ecbdata.file = o->file; xpp.flags = XDF_NEED_MINIMAL | o->xdl_opts; xecfg.ctxlen = o->context; + xecfg.interhunkctxlen = o->interhunkcontext; xecfg.flags = XDL_EMIT_FUNCNAMES; if (pe) xdiff_set_find_func(&xecfg, pe->pattern, pe->cflags); @@@ -2039,7 -2040,7 +2040,7 @@@ static void diff_fill_sha1_info(struct if (lstat(one->path, &st) < 0) die("stat %s", one->path); if (index_path(one->sha1, one->path, &st, 0)) - die("cannot hash %s\n", one->path); + die("cannot hash %s", one->path); } } else @@@ -2538,6 -2539,9 +2539,9 @@@ int diff_opt_parse(struct diff_options options->b_prefix = arg + 13; else if (!strcmp(arg, "--no-prefix")) options->a_prefix = options->b_prefix = ""; + else if (opt_arg(arg, '\0', "inter-hunk-context", + &options->interhunkcontext)) + ; else if (!prefixcmp(arg, "--output=")) { options->file = fopen(arg + strlen("--output="), "w"); options->close_file = 1;