Merge branch 'jc/diff-prefix'
authorJunio C Hamano <gitster@pobox.com>
Fri, 19 Sep 2008 03:30:07 +0000 (20:30 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Sep 2008 03:30:07 +0000 (20:30 -0700)
* jc/diff-prefix:
diff: vary default prefix depending on what are compared

1  2 
Documentation/config.txt
builtin-diff.c
combine-diff.c
diff.c
diff.h
diff --combined Documentation/config.txt
index 922ac7b44da1c2cc04bf024307e9ccd54709580f,74af36de5cadf36041fcf9f33ca52837c452689f..bea867df6005db3f9ea5aed4d303b4a77d94c1ca
@@@ -572,10 -572,6 +572,10 @@@ diff.autorefreshindex:
        affects only 'git-diff' Porcelain, and not lower level
        'diff' commands, such as 'git-diff-files'.
  
 +diff.suppress-blank-empty::
 +      A boolean to inhibit the standard behavior of printing a space
 +      before each empty output line. Defaults to false.
 +
  diff.external::
        If this config variable is set, diff generation is not
        performed using the internal diff machinery, but using the
        you want to use an external diff program only on a subset of
        your files, you might want to use linkgit:gitattributes[5] instead.
  
+ diff.mnemonicprefix::
+       If set, 'git-diff' uses a prefix pair that is different from the
+       standard "a/" and "b/" depending on what is being compared.  When
+       this configuration is in effect, reverse diff output also swaps
+       the order of the prefixes:
+ 'git-diff';;
+       compares the (i)ndex and the (w)ork tree;
+ 'git-diff HEAD';;
+        compares a (c)ommit and the (w)ork tree;
+ 'git diff --cached';;
+       compares a (c)ommit and the (i)ndex;
+ 'git-diff HEAD:file1 file2';;
+       compares an (o)bject and a (w)ork tree entity;
+ 'git diff --no-index a b';;
+       compares two non-git things (1) and (2).
  diff.renameLimit::
        The number of files to consider when performing the copy/rename
        detection; equivalent to the 'git-diff' option '-l'.
@@@ -697,7 -709,7 +713,7 @@@ gitcvs.logfile:
        Path to a log file where the CVS server interface well... logs
        various stuff. See linkgit:git-cvsserver[1].
  
 -gitcvs.usecrlfattr
 +gitcvs.usecrlfattr::
        If true, the server will look up the `crlf` attribute for
        files to determine the '-k' modes to use. If `crlf` is set,
        the '-k' mode will be left blank, so cvs clients will
@@@ -790,15 -802,6 +806,15 @@@ help.format:
        Values 'man', 'info', 'web' and 'html' are supported. 'man' is
        the default. 'web' and 'html' are the same.
  
 +help.autocorrect::
 +      Automatically correct and execute mistyped commands after
 +      waiting for the given number of deciseconds (0.1 sec). If more
 +      than one command can be deduced from the entered text, nothing
 +      will be executed.  If the value of this option is negative,
 +      the corrected command will be executed immediately. If the
 +      value is 0 - the command will be just shown but not executed.
 +      This is the default.
 +
  http.proxy::
        Override the HTTP proxy, normally configured using the 'http_proxy'
        environment variable (see linkgit:curl[1]).  This can be overridden
diff --combined builtin-diff.c
index 037c3039a43d198f228fbc64e46d85d4170c1329,266337b832a020b97ab59cefb4ea1f05404fd00b..52470c7f41b914932d404a5813e8ae156346beca
@@@ -74,6 -74,8 +74,8 @@@ static int builtin_diff_b_f(struct rev_
        if (!(S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)))
                die("'%s': not a regular file or symlink", path);
  
+       diff_set_mnemonic_prefix(&revs->diffopt, "o/", "w/");
        if (blob[0].mode == S_IFINVALID)
                blob[0].mode = canon_mode(st.st_mode);
  
@@@ -122,8 -124,6 +124,8 @@@ static int builtin_diff_index(struct re
                        usage(builtin_diff_usage);
                argv++; argc--;
        }
 +      if (!cached)
 +              setup_work_tree();
        /*
         * Make sure there is one revision (i.e. pending object),
         * and there is no revision filtering parameters.
@@@ -227,7 -227,6 +229,7 @@@ static int builtin_diff_files(struct re
            (revs->diffopt.output_format & DIFF_FORMAT_PATCH))
                revs->combine_merges = revs->dense_combined_merges = 1;
  
 +      setup_work_tree();
        if (read_cache() < 0) {
                perror("read_cache");
                return -1;
diff --combined combine-diff.c
index dcb90b1701aab6f2e22a0953067d85dcf734d6d2,19bd60e34626d07cf7f3df96a20a88503692d692..de83c6972e9dffbd634e5cc09b5e455ec22c6c48
@@@ -143,6 -143,8 +143,6 @@@ static void append_lost(struct sline *s
  }
  
  struct combine_diff_state {
 -      struct xdiff_emit_state xm;
 -
        unsigned int lno;
        int ob, on, nb, nn;
        unsigned long nmask;
@@@ -215,15 -217,17 +215,15 @@@ static void combine_diff(const unsigne
        parent_file.size = sz;
        xpp.flags = XDF_NEED_MINIMAL;
        memset(&xecfg, 0, sizeof(xecfg));
 -      ecb.outf = xdiff_outf;
 -      ecb.priv = &state;
        memset(&state, 0, sizeof(state));
 -      state.xm.consume = consume_line;
        state.nmask = nmask;
        state.sline = sline;
        state.lno = 1;
        state.num_parent = num_parent;
        state.n = n;
  
 -      xdi_diff(&parent_file, result_file, &xpp, &xecfg, &ecb);
 +      xdi_diff_outf(&parent_file, result_file, consume_line, &state,
 +                    &xpp, &xecfg, &ecb);
        free(parent_file.ptr);
  
        /* Assign line numbers for this parent.
@@@ -496,18 -500,6 +496,18 @@@ static int hunk_comment_line(const cha
        return (isalpha(ch) || ch == '_' || ch == '$');
  }
  
 +static void show_line_to_eol(const char *line, int len, const char *reset)
 +{
 +      int saw_cr_at_eol = 0;
 +      if (len < 0)
 +              len = strlen(line);
 +      saw_cr_at_eol = (len && line[len-1] == '\r');
 +
 +      printf("%.*s%s%s\n", len - saw_cr_at_eol, line,
 +             reset,
 +             saw_cr_at_eol ? "\r" : "");
 +}
 +
  static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
                       int use_color)
  {
                                        else
                                                putchar(' ');
                                }
 -                              printf("%s%s\n", ll->line, c_reset);
 +                              show_line_to_eol(ll->line, -1, c_reset);
                                ll = ll->next;
                        }
                        if (cnt < lno)
                                        putchar(' ');
                                p_mask <<= 1;
                        }
 -                      printf("%.*s%s\n", sl->len, sl->bol, c_reset);
 +                      show_line_to_eol(sl->bol, sl->len, c_reset);
                }
        }
  }
@@@ -683,9 -675,13 +683,13 @@@ static void show_patch_diff(struct comb
        int i, show_hunks;
        int working_tree_file = is_null_sha1(elem->sha1);
        int abbrev = DIFF_OPT_TST(opt, FULL_INDEX) ? 40 : DEFAULT_ABBREV;
+       const char *a_prefix, *b_prefix;
        mmfile_t result_file;
  
        context = opt->context;
+       a_prefix = opt->a_prefix ? opt->a_prefix : "a/";
+       b_prefix = opt->b_prefix ? opt->b_prefix : "b/";
        /* Read the result of merge first */
        if (!working_tree_file)
                result = grab_blob(elem->sha1, &result_size);
                        dump_quoted_path("--- ", "", "/dev/null",
                                         c_meta, c_reset);
                else
-                       dump_quoted_path("--- ", opt->a_prefix, elem->path,
+                       dump_quoted_path("--- ", a_prefix, elem->path,
                                         c_meta, c_reset);
                if (deleted)
                        dump_quoted_path("+++ ", "", "/dev/null",
                                         c_meta, c_reset);
                else
-                       dump_quoted_path("+++ ", opt->b_prefix, elem->path,
+                       dump_quoted_path("+++ ", b_prefix, elem->path,
                                         c_meta, c_reset);
                dump_sline(sline, cnt, num_parent,
                           DIFF_OPT_TST(opt, COLOR_DIFF));
diff --combined diff.c
index 998dcaa5edd25d35047749fd6892beb1e829a08b,c1804efed930a2d86e77b01241be0422f74c76c4..9053d4d1f6e886835813e8ba62a7d7767eefe1c8
--- 1/diff.c
--- 2/diff.c
+++ b/diff.c
  
  static int diff_detect_rename_default;
  static int diff_rename_limit_default = 200;
 +static int diff_suppress_blank_empty;
  int diff_use_color_default = -1;
  static const char *external_diff_cmd_cfg;
  int diff_auto_refresh_index = 1;
+ static int diff_mnemonic_prefix;
  
  static char diff_colors[][COLOR_MAXLEN] = {
        "\033[m",       /* reset */
@@@ -150,6 -150,10 +151,10 @@@ int git_diff_ui_config(const char *var
                diff_auto_refresh_index = git_config_bool(var, value);
                return 0;
        }
+       if (!strcmp(var, "diff.mnemonicprefix")) {
+               diff_mnemonic_prefix = git_config_bool(var, value);
+               return 0;
+       }
        if (!strcmp(var, "diff.external"))
                return git_config_string(&external_diff_cmd_cfg, var, value);
        if (!prefixcmp(var, "diff.")) {
@@@ -177,12 -181,6 +182,12 @@@ int git_diff_basic_config(const char *v
                return 0;
        }
  
 +      /* like GNU diff's --suppress-blank-empty option  */
 +      if (!strcmp(var, "diff.suppress-blank-empty")) {
 +              diff_suppress_blank_empty = git_config_bool(var, value);
 +              return 0;
 +      }
 +
        if (!prefixcmp(var, "diff.")) {
                const char *ep = strrchr(var, '.');
                if (ep != var + 4) {
@@@ -312,6 -310,15 +317,15 @@@ static void emit_rewrite_diff(const cha
        const char *new = diff_get_color(color_diff, DIFF_FILE_NEW);
        const char *reset = diff_get_color(color_diff, DIFF_RESET);
        static struct strbuf a_name = STRBUF_INIT, b_name = STRBUF_INIT;
+       const char *a_prefix, *b_prefix;
+       if (diff_mnemonic_prefix && DIFF_OPT_TST(o, REVERSE_DIFF)) {
+               a_prefix = o->b_prefix;
+               b_prefix = o->a_prefix;
+       } else {
+               a_prefix = o->a_prefix;
+               b_prefix = o->b_prefix;
+       }
  
        name_a += (*name_a == '/');
        name_b += (*name_b == '/');
  
        strbuf_reset(&a_name);
        strbuf_reset(&b_name);
-       quote_two_c_style(&a_name, o->a_prefix, name_a, 0);
-       quote_two_c_style(&b_name, o->b_prefix, name_b, 0);
+       quote_two_c_style(&a_name, a_prefix, name_a, 0);
+       quote_two_c_style(&b_name, b_prefix, name_b, 0);
  
        diff_populate_filespec(one, 0);
        diff_populate_filespec(two, 0);
@@@ -376,6 -383,7 +390,6 @@@ static void diff_words_append(char *lin
  }
  
  struct diff_words_data {
 -      struct xdiff_emit_state xm;
        struct diff_words_buffer minus, plus;
        FILE *file;
  };
@@@ -465,8 -473,11 +479,8 @@@ static void diff_words_show(struct diff
  
        xpp.flags = XDF_NEED_MINIMAL;
        xecfg.ctxlen = diff_words->minus.alloc + diff_words->plus.alloc;
 -      ecb.outf = xdiff_outf;
 -      ecb.priv = diff_words;
 -      diff_words->xm.consume = fn_out_diff_words_aux;
 -      xdi_diff(&minus, &plus, &xpp, &xecfg, &ecb);
 -
 +      xdi_diff_outf(&minus, &plus, fn_out_diff_words_aux, diff_words,
 +                    &xpp, &xecfg, &ecb);
        free(minus.ptr);
        free(plus.ptr);
        diff_words->minus.text.size = diff_words->plus.text.size = 0;
  typedef unsigned long (*sane_truncate_fn)(char *line, unsigned long len);
  
  struct emit_callback {
 -      struct xdiff_emit_state xm;
        int nparents, color_diff;
        unsigned ws_rule;
        sane_truncate_fn truncate;
@@@ -513,20 -525,13 +527,20 @@@ const char *diff_get_color(int diff_use
  
  static void emit_line(FILE *file, const char *set, const char *reset, const char *line, int len)
  {
 -      int has_trailing_newline = (len > 0 && line[len-1] == '\n');
 +      int has_trailing_newline, has_trailing_carriage_return;
 +
 +      has_trailing_newline = (len > 0 && line[len-1] == '\n');
        if (has_trailing_newline)
                len--;
 +      has_trailing_carriage_return = (len > 0 && line[len-1] == '\r');
 +      if (has_trailing_carriage_return)
 +              len--;
  
        fputs(set, file);
        fwrite(line, len, 1, file);
        fputs(reset, file);
 +      if (has_trailing_carriage_return)
 +              fputc('\r', file);
        if (has_trailing_newline)
                fputc('\n', file);
  }
@@@ -589,12 -594,6 +603,12 @@@ static void fn_out_consume(void *priv, 
                ecbdata->label_path[0] = ecbdata->label_path[1] = NULL;
        }
  
 +      if (diff_suppress_blank_empty
 +          && len == 2 && line[0] == ' ' && line[1] == '\n') {
 +              line[0] = '\n';
 +              len = 1;
 +      }
 +
        /* This is not really necessary for now because
         * this codepath only deals with two-way diffs.
         */
@@@ -723,6 -722,8 +737,6 @@@ static char *pprint_rename(const char *
  }
  
  struct diffstat_t {
 -      struct xdiff_emit_state xm;
 -
        int nr;
        int alloc;
        struct diffstat_file {
@@@ -1085,7 -1086,7 +1099,7 @@@ static void show_dirstat(struct diff_op
        dir.alloc = 0;
        dir.nr = 0;
        dir.percent = options->dirstat_percent;
 -      dir.cumulative = options->output_format & DIFF_FORMAT_CUMULATIVE;
 +      dir.cumulative = DIFF_OPT_TST(options, DIRSTAT_CUMULATIVE);
  
        changed = 0;
        for (i = 0; i < q->nr; i++) {
@@@ -1152,6 -1153,7 +1166,6 @@@ static void free_diffstat_info(struct d
  }
  
  struct checkdiff_t {
 -      struct xdiff_emit_state xm;
        const char *filename;
        int lineno;
        struct diff_options *o;
@@@ -1396,8 -1398,6 +1410,8 @@@ static struct builtin_funcname_pattern 
        const char *name;
        const char *pattern;
  } builtin_funcname_pattern[] = {
 +      { "bibtex", "\\(@[a-zA-Z]\\{1,\\}[ \t]*{\\{0,1\\}[ \t]*[^ \t\"@',\\#}{~%]*\\).*$" },
 +      { "html", "^\\s*\\(<[Hh][1-6]\\s.*>.*\\)$" },
        { "java", "!^[  ]*\\(catch\\|do\\|for\\|if\\|instanceof\\|"
                        "new\\|return\\|switch\\|throw\\|while\\)\n"
                        "^[     ]*\\(\\([       ]*"
                        "\\|"
                        "^\\(.*=[ \t]*\\(class\\|record\\).*\\)$"
                        },
 -      { "bibtex", "\\(@[a-zA-Z]\\{1,\\}[ \t]*{\\{0,1\\}[ \t]*[^ \t\"@',\\#}{~%]*\\).*$" },
 -      { "tex", "^\\(\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*\\{0,1\\}{.*\\)$" },
 +      { "php", "^[\t ]*\\(\\(function\\|class\\).*\\)" },
 +      { "python", "^\\s*\\(\\(class\\|def\\)\\s.*\\)$" },
        { "ruby", "^\\s*\\(\\(class\\|module\\|def\\)\\s.*\\)$" },
 +      { "tex", "^\\(\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*\\{0,1\\}{.*\\)$" },
  };
  
  static const char *diff_funcname_pattern(struct diff_filespec *one)
        return NULL;
  }
  
+ void diff_set_mnemonic_prefix(struct diff_options *options, const char *a, const char *b)
+ {
+       if (!options->a_prefix)
+               options->a_prefix = a;
+       if (!options->b_prefix)
+               options->b_prefix = b;
+ }
  static void builtin_diff(const char *name_a,
                         const char *name_b,
                         struct diff_filespec *one,
        char *a_one, *b_two;
        const char *set = diff_get_color_opt(o, DIFF_METAINFO);
        const char *reset = diff_get_color_opt(o, DIFF_RESET);
+       const char *a_prefix, *b_prefix;
+       diff_set_mnemonic_prefix(o, "a/", "b/");
+       if (DIFF_OPT_TST(o, REVERSE_DIFF)) {
+               a_prefix = o->b_prefix;
+               b_prefix = o->a_prefix;
+       } else {
+               a_prefix = o->a_prefix;
+               b_prefix = o->b_prefix;
+       }
  
-       a_one = quote_two(o->a_prefix, name_a + (*name_a == '/'));
-       b_two = quote_two(o->b_prefix, name_b + (*name_b == '/'));
+       a_one = quote_two(a_prefix, name_a + (*name_a == '/'));
+       b_two = quote_two(b_prefix, name_b + (*name_b == '/'));
        lbl[0] = DIFF_FILE_VALID(one) ? a_one : "/dev/null";
        lbl[1] = DIFF_FILE_VALID(two) ? b_two : "/dev/null";
        fprintf(o->file, "%sdiff --git %s %s%s\n", set, a_one, b_two, reset);
                        xecfg.ctxlen = strtoul(diffopts + 10, NULL, 10);
                else if (!prefixcmp(diffopts, "-u"))
                        xecfg.ctxlen = strtoul(diffopts + 2, NULL, 10);
 -              ecb.outf = xdiff_outf;
 -              ecb.priv = &ecbdata;
 -              ecbdata.xm.consume = fn_out_consume;
                if (DIFF_OPT_TST(o, COLOR_DIFF_WORDS)) {
                        ecbdata.diff_words =
                                xcalloc(1, sizeof(struct diff_words_data));
                        ecbdata.diff_words->file = o->file;
                }
 -              xdi_diff(&mf1, &mf2, &xpp, &xecfg, &ecb);
 +              xdi_diff_outf(&mf1, &mf2, fn_out_consume, &ecbdata,
 +                            &xpp, &xecfg, &ecb);
                if (DIFF_OPT_TST(o, COLOR_DIFF_WORDS))
                        free_diff_words_data(&ecbdata);
        }
@@@ -1601,8 -1620,9 +1633,8 @@@ static void builtin_diffstat(const cha
  
                memset(&xecfg, 0, sizeof(xecfg));
                xpp.flags = XDF_NEED_MINIMAL | o->xdl_opts;
 -              ecb.outf = xdiff_outf;
 -              ecb.priv = diffstat;
 -              xdi_diff(&mf1, &mf2, &xpp, &xecfg, &ecb);
 +              xdi_diff_outf(&mf1, &mf2, diffstat_consume, diffstat,
 +                            &xpp, &xecfg, &ecb);
        }
  
   free_and_return:
@@@ -1623,6 -1643,7 +1655,6 @@@ static void builtin_checkdiff(const cha
                return;
  
        memset(&data, 0, sizeof(data));
 -      data.xm.consume = checkdiff_consume;
        data.filename = name_b ? name_b : name_a;
        data.lineno = 0;
        data.o = o;
                memset(&xecfg, 0, sizeof(xecfg));
                xecfg.ctxlen = 1; /* at least one context line */
                xpp.flags = XDF_NEED_MINIMAL;
 -              ecb.outf = xdiff_outf;
 -              ecb.priv = &data;
 -              xdi_diff(&mf1, &mf2, &xpp, &xecfg, &ecb);
 +              xdi_diff_outf(&mf1, &mf2, checkdiff_consume, &data,
 +                            &xpp, &xecfg, &ecb);
  
                if ((data.ws_rule & WS_TRAILING_SPACE) &&
                    data.trailing_blanks_start) {
@@@ -2308,7 -2330,6 +2340,7 @@@ void diff_setup(struct diff_options *op
        options->break_opt = -1;
        options->rename_limit = -1;
        options->dirstat_percent = 3;
 +      DIFF_OPT_CLR(options, DIRSTAT_CUMULATIVE);
        options->context = 3;
  
        options->change = diff_change;
                DIFF_OPT_CLR(options, COLOR_DIFF);
        options->detect_rename = diff_detect_rename_default;
  
-       options->a_prefix = "a/";
-       options->b_prefix = "b/";
+       if (!diff_mnemonic_prefix) {
+               options->a_prefix = "a/";
+               options->b_prefix = "b/";
+       }
  }
  
  int diff_setup_done(struct diff_options *options)
                DIFF_OPT_SET(options, EXIT_WITH_STATUS);
        }
  
 -      /*
 -       * If we postprocess in diffcore, we cannot simply return
 -       * upon the first hit.  We need to run diff as usual.
 -       */
 -      if (options->pickaxe || options->filter)
 -              DIFF_OPT_CLR(options, QUIET);
 -
        return 0;
  }
  
@@@ -2474,10 -2504,8 +2508,10 @@@ int diff_opt_parse(struct diff_options 
                options->output_format |= DIFF_FORMAT_SHORTSTAT;
        else if (opt_arg(arg, 'X', "dirstat", &options->dirstat_percent))
                options->output_format |= DIFF_FORMAT_DIRSTAT;
 -      else if (!strcmp(arg, "--cumulative"))
 -              options->output_format |= DIFF_FORMAT_CUMULATIVE;
 +      else if (!strcmp(arg, "--cumulative")) {
 +              options->output_format |= DIFF_FORMAT_DIRSTAT;
 +              DIFF_OPT_SET(options, DIRSTAT_CUMULATIVE);
 +      }
        else if (!strcmp(arg, "--check"))
                options->output_format |= DIFF_FORMAT_CHECKDIFF;
        else if (!strcmp(arg, "--summary"))
@@@ -3033,6 -3061,7 +3067,6 @@@ static void diff_summary(FILE *file, st
  }
  
  struct patch_id_t {
 -      struct xdiff_emit_state xm;
        SHA_CTX *ctx;
        int patchlen;
  };
@@@ -3077,6 -3106,7 +3111,6 @@@ static int diff_get_patch_id(struct dif
        SHA1_Init(&ctx);
        memset(&data, 0, sizeof(struct patch_id_t));
        data.ctx = &ctx;
 -      data.xm.consume = patch_id_consume;
  
        for (i = 0; i < q->nr; i++) {
                xpparam_t xpp;
                xpp.flags = XDF_NEED_MINIMAL;
                xecfg.ctxlen = 3;
                xecfg.flags = XDL_EMIT_FUNCNAMES;
 -              ecb.outf = xdiff_outf;
 -              ecb.priv = &data;
 -              xdi_diff(&mf1, &mf2, &xpp, &xecfg, &ecb);
 +              xdi_diff_outf(&mf1, &mf2, patch_id_consume, &data,
 +                            &xpp, &xecfg, &ecb);
        }
  
        SHA1_Final(sha1, &ctx);
@@@ -3219,6 -3250,7 +3253,6 @@@ void diff_flush(struct diff_options *op
                struct diffstat_t diffstat;
  
                memset(&diffstat, 0, sizeof(struct diffstat_t));
 -              diffstat.xm.consume = diffstat_consume;
                for (i = 0; i < q->nr; i++) {
                        struct diff_filepair *p = q->queue[i];
                        if (check_pair_status(p))
@@@ -3390,7 -3422,10 +3424,7 @@@ static void diffcore_skip_stat_unmatch(
  
  void diffcore_std(struct diff_options *options)
  {
 -      if (DIFF_OPT_TST(options, QUIET))
 -              return;
 -
 -      if (options->skip_stat_unmatch && !DIFF_OPT_TST(options, FIND_COPIES_HARDER))
 +      if (options->skip_stat_unmatch)
                diffcore_skip_stat_unmatch(options);
        if (options->break_opt != -1)
                diffcore_break(options->break_opt);
diff --combined diff.h
index 7f53bebf335148a5f623b5fcbe6142e6c4b53282,9a679f58f56589b1457bf58ca85c1102af2dade3..1ca4f4628473c940fa0399b23f8da5c92a424dd5
--- 1/diff.h
--- 2/diff.h
+++ b/diff.h
@@@ -31,6 -31,7 +31,6 @@@ typedef void (*diff_format_fn_t)(struc
  #define DIFF_FORMAT_PATCH     0x0010
  #define DIFF_FORMAT_SHORTSTAT 0x0020
  #define DIFF_FORMAT_DIRSTAT   0x0040
 -#define DIFF_FORMAT_CUMULATIVE        0x0080
  
  /* These override all above */
  #define DIFF_FORMAT_NAME      0x0100
@@@ -63,7 -64,6 +63,7 @@@
  #define DIFF_OPT_CHECK_FAILED        (1 << 16)
  #define DIFF_OPT_RELATIVE_NAME       (1 << 17)
  #define DIFF_OPT_IGNORE_SUBMODULES   (1 << 18)
 +#define DIFF_OPT_DIRSTAT_CUMULATIVE  (1 << 19)
  #define DIFF_OPT_TST(opts, flag)    ((opts)->flags & DIFF_OPT_##flag)
  #define DIFF_OPT_SET(opts, flag)    ((opts)->flags |= DIFF_OPT_##flag)
  #define DIFF_OPT_CLR(opts, flag)    ((opts)->flags &= ~DIFF_OPT_##flag)
@@@ -160,6 -160,8 +160,8 @@@ extern void diff_tree_combined(const un
  
  extern void diff_tree_combined_merge(const unsigned char *sha1, int, struct rev_info *);
  
+ void diff_set_mnemonic_prefix(struct diff_options *options, const char *a, const char *b);
  extern void diff_addremove(struct diff_options *,
                           int addremove,
                           unsigned mode,