From: Eric Sunshine <sunshine@sunshineco.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org, Yasushi SHOJI <yasushi.shoji@gmail.com>
Subject: Re: [PATCH 1/2] object-name: detect and report empty reflogs
Date: Wed, 21 Feb 2024 11:48:40 -0500 [thread overview]
Message-ID: <CAPig+cQff2LUnsXf+NMuAczN0sVNbPU9fOSFapeMSDBpMYkedQ@mail.gmail.com> (raw)
In-Reply-To: <0fac6ebb098c7e8cdc87cb75f2dcffdc4b1ccfaa.1708509190.git.ps@pks.im>
On Wed, Feb 21, 2024 at 5:03 AM Patrick Steinhardt <ps@pks.im> wrote:
> [...]
> Start to detect and report empty or missing reflogs in `read_ref_at()`
> and report them to the caller. This results in a change in behaviour
> when asking for `ref@{0}` with an empty or missing reflog because we now
> die instead of returning the object ID of the ref itself. This adapted
> behaviour should lead to less surprises as we now really only report
> object IDs to the caller that actually come from the reflog, thus making
> the user experience a whole lot more consistent.
> [...]
> Reported-by: Yasushi SHOJI <yasushi.shoji@gmail.com>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> diff --git a/t/t1508-at-combinations.sh b/t/t1508-at-combinations.sh
> @@ -110,10 +110,31 @@ test_expect_success '@{1} works with only one reflog entry' '
> +test_expect_success '@{0} fails with empty reflog' '
> + git checkout -B empty-reflog main &&
> + git reflog expire --expire=now refs/heads/empty-reflog &&
> + cat >expect <<-EOF &&
> + fatal: Needed a single revision
> + EOF
Typically, we would use <<-\EOF rather than <<-EOF to signal to the
reader that no variable interpolation is happening in the here-doc
body.
A simpler alternative in this case would, of course, be to use `echo`:
echo "fatal: Needed a single revision" >expect &&
> + test_must_fail git rev-parse --verify missing-reflog@{0} 2>err &&
> + test_cmp expect err
> +'
> +
> +test_expect_success '@{0} fails with missing reflog' '
> + git -c core.logAllRefUpdates=false checkout -B missing-reflog main &&
> + cat >expect <<-EOF &&
> + fatal: Needed a single revision
> + EOF
Ditto.
> + test_must_fail git rev-parse --verify missing-reflog@{0} 2>err &&
> + test_cmp expect err
> +'
Probably neither comment is worth a reroll, but if you reroll for some
other reason, perhaps consider them.
next prev parent reply other threads:[~2024-02-21 16:48 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-21 1:48 Segfault: git show-branch --reflog refs/pullreqs/1 Yasushi SHOJI
2024-02-21 8:42 ` Jeff King
2024-02-21 10:05 ` Patrick Steinhardt
2024-02-21 17:38 ` Jeff King
2024-02-21 17:44 ` Junio C Hamano
2024-02-22 9:02 ` Patrick Steinhardt
2024-02-22 16:32 ` Junio C Hamano
2024-02-22 17:22 ` Jeff King
2024-02-26 10:00 ` [PATCH 0/3] show-branch --reflog fixes Jeff King
2024-02-26 10:02 ` [PATCH 1/3] Revert "refs: allow @{n} to work with n-sized reflog" Jeff King
2024-02-26 10:04 ` [PATCH 2/3] get_oid_basic(): special-case ref@{n} for oldest reflog entry Jeff King
2024-02-26 15:59 ` Junio C Hamano
2024-02-26 10:08 ` [PATCH 3/3] read_ref_at(): special-case ref@{0} for an empty reflog Jeff King
2024-02-26 10:10 ` Jeff King
2024-02-26 17:25 ` Junio C Hamano
2024-02-27 8:07 ` Jeff King
2024-02-26 17:25 ` Junio C Hamano
2024-02-27 8:05 ` Jeff King
2024-02-27 17:03 ` Junio C Hamano
2024-02-21 9:52 ` Segfault: git show-branch --reflog refs/pullreqs/1 Patrick Steinhardt
2024-02-21 9:56 ` [PATCH 0/2] Detect empty or missing reflogs with `ref@{0}` Patrick Steinhardt
2024-02-21 9:56 ` [PATCH 1/2] object-name: detect and report empty reflogs Patrick Steinhardt
2024-02-21 10:37 ` Kristoffer Haugsbakk
2024-02-21 16:48 ` Eric Sunshine [this message]
2024-02-21 17:31 ` Jeff King
2024-02-21 9:56 ` [PATCH 2/2] builtin/show-branch: detect " Patrick Steinhardt
2024-02-21 17:35 ` Jeff King
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=CAPig+cQff2LUnsXf+NMuAczN0sVNbPU9fOSFapeMSDBpMYkedQ@mail.gmail.com \
--to=sunshine@sunshineco.com \
--cc=git@vger.kernel.org \
--cc=ps@pks.im \
--cc=yasushi.shoji@gmail.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).