From: Junio C Hamano <gitster@pobox.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Kristoffer Haugsbakk <code@khaugsbakk.name>,
ks1322@gmail.com, git@vger.kernel.org
Subject: Re: [PATCH v2] grep: die gracefully when outside repository
Date: Fri, 20 Oct 2023 11:06:03 -0700 [thread overview]
Message-ID: <xmqqcyx9qid0.fsf@gitster.g> (raw)
In-Reply-To: <CAPig+cTBYw9=Wo=TR8MD5xX9hgurnfR2Xzc_wHSYnL1R00=xpw@mail.gmail.com> (Eric Sunshine's message of "Fri, 20 Oct 2023 13:05:03 -0400")
Eric Sunshine <sunshine@sunshineco.com> writes:
> On Fri, Oct 20, 2023 at 12:40 PM Kristoffer Haugsbakk
> <code@khaugsbakk.name> wrote:
>> Die gracefully when `git grep --no-index` is run outside of a Git
>> repository and the path is outside the directory tree.
>>
>> If you are not in a Git repository and say:
>>
>> git grep --no-index search ..
>>
>> You trigger a `BUG`:
>>
>> BUG: environment.c:213: git environment hasn't been setup
>> Aborted (core dumped)
>>
>> Because `..` is a valid path which is treated as a pathspec. Then
>> `pathspec` figures out that it is not in the current directory tree. The
>> `BUG` is triggered when `pathspec` tries to advice the user about how the
>> path is not in the current (non-existing) repository.
>
> s/advice/advise/
>
> (probably not worth a reroll)
The only remaining niggle I have is that the effect of this change
would be much wider than just "grep", but in "git shortlog" output
it may appear that this is specific to it, making later developers'
life a bit harder when they are hunting for the cause of a behaviour
change that is outside "grep", but still caused by this patch.
But I think I am worried too much in this particular case. Once
this codepath is entered, the code will die no matter what, and we
are merely making it die a bit more nicely.
There still is the "we say different things depending on the path
outside the hierarchy exists or not" raised by Peff remaining, but
for now, let's declare a victory and merge it to 'next'.
Thanks.
next prev parent reply other threads:[~2023-10-20 18:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-14 15:42 Bug: git grep --no-index 123 /dev/stdin crashes with SIGABRT ks1322 ks1322
2023-10-14 18:12 ` Kristoffer Haugsbakk
2023-10-14 19:37 ` Kristoffer Haugsbakk
2023-10-14 21:02 ` [PATCH] grep: die gracefully when outside repository Kristoffer Haugsbakk
2023-10-15 3:26 ` Jeff King
2023-10-15 8:00 ` Kristoffer Haugsbakk
2023-10-15 17:57 ` Junio C Hamano
2023-10-17 16:42 ` Junio C Hamano
2023-10-17 19:51 ` Kristoffer Haugsbakk
2023-10-17 20:25 ` Junio C Hamano
2023-10-17 20:39 ` Junio C Hamano
2023-10-20 16:40 ` [PATCH v2] " Kristoffer Haugsbakk
2023-10-20 17:05 ` Eric Sunshine
2023-10-20 18:06 ` Junio C Hamano [this message]
2023-10-20 18:04 ` [PATCH v3] " Kristoffer Haugsbakk
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqcyx9qid0.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=code@khaugsbakk.name \
--cc=git@vger.kernel.org \
--cc=ks1322@gmail.com \
--cc=sunshine@sunshineco.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.
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 NNTP newsgroup(s).