From: Junio C Hamano Date: Wed, 29 Sep 2010 20:49:03 +0000 (-0700) Subject: Merge branch 'jc/pickaxe-grep' X-Git-Tag: v1.7.4-rc0~205 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b3c16ee454effda5ec8033ab665249710f622699;hp=-c;p=git.git Merge branch 'jc/pickaxe-grep' * jc/pickaxe-grep: diff/log -G: tests git log/diff: add -G that greps in the patch text diff: pass the entire diff-options to diffcore_pickaxe() gitdiffcore doc: update pickaxe description --- b3c16ee454effda5ec8033ab665249710f622699 diff --combined diff.c index 0e2e872e0,9095be16f..71efa8edd --- a/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; @@@ -3310,7 -3312,7 +3315,7 @@@ 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)