Re: [PATCH v2 21/22] pickaxe -G: terminate early on matching lines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ævar Arnfjörð Bjarmason  <avarab@xxxxxxxxx> writes:

> Solve a long-standing item for "git log -Grx" of us e.g. finding "+
> str" in the diff context and noting that we had a "hit", but xdiff
> diligently continuing to generate and spew the rest of the diff at us.
>

Nice.  "git log -Gpattern" without "-p" has no reason to do the full
diff once it finds out that pattern would have existed if "-p" were
given in the output.

It actually is a bit of shame that "git log -Gpattern -p" still
needs to run two diffs (instead of taking advantage of the diff that
it needs to generate anyway (to show to the user of the "log") and
pattern match in it).

>  	if (data->hit)
> +		BUG("Already matched in diffgrep_consume! Broken xdiff_emit_line_fn?");

Hmph, an obvious alternative would be to silently return -1 here,
which probably would not hurt, either.  I do not mind the check to
be stricter, though.

> +	if (!regexec_buf(data->regexp, line + 1, len - 1, 1,
> +			 &regmatch, 0)) {
> +		data->hit = 1;
> +		return -1;
> +	}
>  	return 0;
>  }




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux