Merge branch 'tb/log-G-binary'

"git log -G<regex>" looked for a hunk in the "git log -p" patch
output that contained a string that matches the given pattern.
Optimize this code to ignore binary files, which by default will
not show any hunk that would match any pattern (unless textconv or
the --text option is in effect, that is).

* tb/log-G-binary:
  log -G: ignore binary files
This commit is contained in:
Junio C Hamano
2019-01-14 15:29:31 -08:00
4 changed files with 48 additions and 1 deletions

View File

@ -154,6 +154,12 @@ static int pickaxe_match(struct diff_filepair *p, struct diff_options *o,
if (textconv_one == textconv_two && diff_unmodified_pair(p))
return 0;
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);