From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, orygaw <orygaw@protonmail.com>,
rsbecker@nexbridge.com, Taylor Blau <me@ttaylorr.com>
Subject: Re: [PATCH] log: require --grep for --invert-grep and --all-match, fix segfault
Date: Mon, 10 Oct 2022 20:48:25 +0200 [thread overview]
Message-ID: <221010.86o7ujpl44.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <xmqq35bv4lns.fsf@gitster.g>
On Mon, Oct 10 2022, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Æ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.
The rationale for changing it this way is that the documentaion says:
--all-match::
Limit the commits output to ones that match all given `--grep`,
instead of ones that match at least one.
--invert-grep::
Limit the commits output to ones with log message that do not
match the pattern specified with `--grep=<pattern>`.
Especially as we also say:
--grep-reflog=<pattern>::
Limit the commits output to ones with reflog entries that
match the specified pattern (regular expression) [...]
I.e. pretty much the same wording, but there we'll die if the
corresponding other option is omitted, as the context shows.
Maybe we want to post-hoc say we'd like to support it, in which case
some plasting over the issue (e.g. in the direction of Taylor's fix)
would do it.
next prev parent reply other threads:[~2022-10-10 18:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 14:33 Git BUG 2.37.3 and 2.38.0 orygaw
2022-10-10 15:40 ` rsbecker
2022-10-10 15:48 ` Taylor Blau
2022-10-10 17:02 ` Junio C Hamano
2022-10-10 16:57 ` [PATCH] log: require --grep for --invert-grep and --all-match, fix segfault Ævar Arnfjörð Bjarmason
2022-10-10 17:34 ` Junio C Hamano
2022-10-10 17:45 ` Junio C Hamano
2022-10-10 18:48 ` Ævar Arnfjörð Bjarmason [this message]
2022-10-10 19:00 ` Taylor Blau
2022-10-11 9:48 ` [PATCH v2] grep.c: remove "extended" in favor of "pattern_expression", " Ævar Arnfjörð Bjarmason
2022-10-11 15:46 ` Junio C Hamano
2022-10-10 17:41 ` [PATCH 0/2] grep: tolerate NULL argument to free_grep_expr() Taylor Blau
2022-10-10 17:41 ` [PATCH 1/2] t4202: demonstrate `git log --invert-grep` segfault Taylor Blau
2022-10-10 17:41 ` [PATCH 2/2] grep.c: tolerate NULL grep_expr in free_pattern_expr() Taylor Blau
2022-10-10 17:54 ` Junio C Hamano
2022-10-10 18:10 ` Taylor Blau
2022-10-10 18:11 ` Junio C Hamano
2022-10-10 18:14 ` Taylor Blau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=221010.86o7ujpl44.gmgdl@evledraar.gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=me@ttaylorr.com \
--cc=orygaw@protonmail.com \
--cc=rsbecker@nexbridge.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).