]> git.ipfire.org Git - thirdparty/git.git/blobdiff - diffcore-pickaxe.c
fetch-pack: support more than one pack lockfile
[thirdparty/git.git] / diffcore-pickaxe.c
index 239ce5122b3a45bec211e0c20113385c0e37805d..a9c6d60df22862e47ccb7fc1c7de9ed7cc4b1236 100644 (file)
@@ -62,7 +62,8 @@ static int diff_grep(mmfile_t *one, mmfile_t *two,
        ecbdata.hit = 0;
        xecfg.ctxlen = o->context;
        xecfg.interhunkctxlen = o->interhunkcontext;
-       if (xdi_diff_outf(one, two, diffgrep_consume, &ecbdata, &xpp, &xecfg))
+       if (xdi_diff_outf(one, two, discard_hunk_line, diffgrep_consume,
+                         &ecbdata, &xpp, &xecfg))
                return 0;
        return ecbdata.hit;
 }
@@ -139,8 +140,8 @@ static int pickaxe_match(struct diff_filepair *p, struct diff_options *o,
                return 0;
 
        if (o->flags.allow_textconv) {
-               textconv_one = get_textconv(p->one);
-               textconv_two = get_textconv(p->two);
+               textconv_one = get_textconv(o->repo, p->one);
+               textconv_two = get_textconv(o->repo, p->two);
        }
 
        /*
@@ -153,8 +154,14 @@ static int pickaxe_match(struct diff_filepair *p, struct diff_options *o,
        if (textconv_one == textconv_two && diff_unmodified_pair(p))
                return 0;
 
-       mf1.size = fill_textconv(textconv_one, p->one, &mf1.ptr);
-       mf2.size = fill_textconv(textconv_two, p->two, &mf2.ptr);
+       if ((o->pickaxe_opts & DIFF_PICKAXE_KIND_G) &&
+           !o->flags.text &&
+           ((!textconv_one && diff_filespec_is_binary(o->repo, p->one)) ||
+            (!textconv_two && diff_filespec_is_binary(o->repo, p->two))))
+               return 0;
+
+       mf1.size = fill_textconv(o->repo, textconv_one, p->one, &mf1.ptr);
+       mf2.size = fill_textconv(o->repo, textconv_two, p->two, &mf2.ptr);
 
        ret = fn(DIFF_FILE_VALID(p->one) ? &mf1 : NULL,
                 DIFF_FILE_VALID(p->two) ? &mf2 : NULL,
@@ -215,7 +222,6 @@ static void regcomp_or_die(regex_t *regex, const char *needle, int cflags)
                /* The POSIX.2 people are surely sick */
                char errbuf[1024];
                regerror(err, regex, errbuf, 1024);
-               regfree(regex);
                die("invalid regex: %s", errbuf);
        }
 }