Re: [PATCH] log: require --grep for --invert-grep and --all-match, fix segfault
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 10, 2022, 17:45 UTC
- Message-ID
- <xmqq35bv4lns.fsf@gitster.g>
- In-Reply-To
- <xmqq7d174m6a.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 15 quoted lines
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes: > >> Neither the "--invert-grep" option added in [1] nor the earlier >> "--all-match" option added in [2] were intended to be used >> stand-alone. > > Mostly yes, but with "to be used" -> "to take effect". > > "[alias] lga = log --all-match" would be equivalent to "log" > unless the command line starts talking about "--grep", which is > quite handy. > > So the real fix would be not to forbid the standalone passing of the > option to the command, but to fix the over-eager freeing of an > unallocated resource, introduced more recently, I would suspect.
On the other hand, I do not think "--invert-grep" is useful in the same way. The only usage I can think of is to omit merges by looking for substring "^Merge", but then we already have a more robust "--no-merges" option for that purpose.
But both uses the same mechanism, I would say treating them the same, i.e. silently ignoring these when --grep is not given, would be the most sensible.
Thanks.