Code

Merge branch 'jc/pickaxe-grep'
authorJunio C Hamano <gitster@pobox.com>
Wed, 29 Sep 2010 20:49:03 +0000 (13:49 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 29 Sep 2010 20:49:03 +0000 (13:49 -0700)
* jc/pickaxe-grep:
  diff/log -G<pattern>: tests
  git log/diff: add -G<regexp> that greps in the patch text
  diff: pass the entire diff-options to diffcore_pickaxe()
  gitdiffcore doc: update pickaxe description

1  2 
diff.c

diff --combined diff.c
index 0e2e872e0bb6b82d08e4dc6415afe875ccccc367,9095be16f6b556f587a610f07ca3cbe6b03a23a6..71efa8edd49fe1c80fb37a0468c68ef5ab0d2596
--- 1/diff.c
--- 2/diff.c
+++ b/diff.c
@@@ -919,10 -919,7 +919,10 @@@ static void free_diff_words_data(struc
                free (ecbdata->diff_words->minus.orig);
                free (ecbdata->diff_words->plus.text.ptr);
                free (ecbdata->diff_words->plus.orig);
 -              free(ecbdata->diff_words->word_regex);
 +              if (ecbdata->diff_words->word_regex) {
 +                      regfree(ecbdata->diff_words->word_regex);
 +                      free(ecbdata->diff_words->word_regex);
 +              }
                free(ecbdata->diff_words);
                ecbdata->diff_words = NULL;
        }
@@@ -3271,12 -3268,17 +3271,17 @@@ int diff_opt_parse(struct diff_options 
        }
        else if ((argcount = short_opt('S', av, &optarg))) {
                options->pickaxe = optarg;
+               options->pickaxe_opts |= DIFF_PICKAXE_KIND_S;
+               return argcount;
+       } else if ((argcount = short_opt('G', av, &optarg))) {
+               options->pickaxe = optarg;
+               options->pickaxe_opts |= DIFF_PICKAXE_KIND_G;
                return argcount;
        }
        else if (!strcmp(arg, "--pickaxe-all"))
-               options->pickaxe_opts = DIFF_PICKAXE_ALL;
+               options->pickaxe_opts |= DIFF_PICKAXE_ALL;
        else if (!strcmp(arg, "--pickaxe-regex"))
-               options->pickaxe_opts = DIFF_PICKAXE_REGEX;
+               options->pickaxe_opts |= DIFF_PICKAXE_REGEX;
        else if ((argcount = short_opt('O', av, &optarg))) {
                options->orderfile = optarg;
                return argcount;
        else if ((argcount = parse_long_opt("output", av, &optarg))) {
                options->file = fopen(optarg, "w");
                if (!options->file)
 -                      die_errno("Could not open '%s'", arg + strlen("--output="));
 +                      die_errno("Could not open '%s'", optarg);
                options->close_file = 1;
                return argcount;
        } else
@@@ -3856,13 -3858,6 +3861,13 @@@ static int diff_get_patch_id(struct dif
                                        len2, p->two->path);
                git_SHA1_Update(&ctx, buffer, len1);
  
 +              if (diff_filespec_is_binary(p->one) ||
 +                  diff_filespec_is_binary(p->two)) {
 +                      git_SHA1_Update(&ctx, sha1_to_hex(p->one->sha1), 40);
 +                      git_SHA1_Update(&ctx, sha1_to_hex(p->two->sha1), 40);
 +                      continue;
 +              }
 +
                xpp.flags = 0;
                xecfg.ctxlen = 3;
                xecfg.flags = XDL_EMIT_FUNCNAMES;
@@@ -4176,7 -4171,7 +4181,7 @@@ void diffcore_std(struct diff_options *
                        diffcore_merge_broken();
        }
        if (options->pickaxe)
-               diffcore_pickaxe(options->pickaxe, options->pickaxe_opts);
+               diffcore_pickaxe(options);
        if (options->orderfile)
                diffcore_order(options->orderfile);
        if (!options->found_follow)