Merge branch 'rs/diff-ihc'
authorJunio C Hamano <gitster@pobox.com>
Wed, 7 Jan 2009 08:10:14 +0000 (00:10 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 7 Jan 2009 08:10:14 +0000 (00:10 -0800)
* rs/diff-ihc:
diff: add option to show context between close hunks

Conflicts:
Documentation/diff-options.txt

1  2 
Documentation/diff-options.txt
contrib/completion/git-completion.bash
diff.c
index b432d2518aba3d1be9d86fb1613bbe2f5fa9da4d,c7fcc8007af18163d7d1583e116b625b54d428ca..671f533ca30c1fb0ddae8a15f9c586c431c8fef5
@@@ -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<n>::
 -      Shorthand for "--unified=<n>".
 -
  --unified=<n>::
        Generate diffs with <n> lines of context instead of
        the usual three. Implies "-p".
        can name which subdirectory to make the output relative
        to by giving a <path> 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=<lines>::
+       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
index 3b25d48098b99646819999bd29e64ade517419d6,a046441974ec1240281058562ce17249fa10d604..8ec782dc54c9eb49873e38b75d925babe9a7746c
@@@ -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 c159a5fc658d762fba10800e5b828ad2f5c00b90,56b80f9609a4cafaf82b711f5f2865eecbba0c74..d23548292ad319defd691655409098f824ec9e94
--- 1/diff.c
--- 2/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;