git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Todd Zullinger" <tmz@pobox.com>,
	"Petr Šplíchal" <psplicha@redhat.com>
Subject: Re: [PATCH] checkout: avoid BUG() when hitting a broken repository
Date: Sat, 22 Jan 2022 12:55:02 +0100	[thread overview]
Message-ID: <220122.86y238ht7r.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <xmqqbl04d1s9.fsf_-_@gitster.g>


On Fri, Jan 21 2022, Junio C Hamano wrote:

> So, taking the two earlier comments from me together...
>
> I _think_ I was the one who spotted the funny skip_prefix() whose
> result was not used, and suggested this unrelated check, during the
> review.  Sorry about that.

Where was that? I don't see a comment like that in the original
thread[1], or do you mean the recent one in [2]?

Doesn't matter much now, but whatever it was I can't find it nor recall
it, or I've misread this.

> [...]
> +test_expect_success 'checkout a branch without refs/heads/* prefix' '
> +	git clone --no-tags . repo-odd-prefix &&
> +	(
> +		cd repo-odd-prefix &&
> +
> +		origin=$(git symbolic-ref refs/remotes/origin/HEAD) &&
> +		git symbolic-ref refs/heads/a-branch "$origin" &&
> +
> +		git checkout -f a-branch &&
> +		git checkout -f a-branch
> +	)
> +'
> +
>  test_expect_success 'checkout -b to a new branch, set to HEAD' '
>  	test_when_finished "
>  		git checkout branch1 &&

It's shortly before the release, so whatever fixes the bug is good with
me, and this patch works.

I don't think dropping the parts of the tests that actually check the
resulting repository state is a good change in this re-imagining of my
initial fix[3].

I see that per your [4] you disagree with the current behavior being
"cast in stone". I also think we should change it, I just think testing
exactly what state we're in before and after will make that easier.

Here we're just testing that we don't die, and not even that it's not a
noop. If and when we change the behavior it'll be extra work to check
that we didn't change something we didn't expect (and basically
requiring digging up [3] again).

In this case we didn't have any test coverage (hence missing the
regression), and with this test we still don't have meaningful coverage.

If you're looking to clearly mark things that are desired v.s. expected
behavior wouldn't that be better done in general via something like a
new "test_expect_oddity"?

Again, for the upcoming release I think this is fine. I'd just like to
clarify the above, since this isn't the first time we've had a back and
forth where you wanted a less specific test that (in the "make coverage"
etc. sense) would lose coverage v.s. a more specific check.

1. https://lore.kernel.org/git/patch-1.1-9b17170b794-20211014T000949Z-avarab@gmail.com/
2. https://lore.kernel.org/git/xmqqr190d2xg.fsf@gitster.g/
3. https://lore.kernel.org/git/patch-1.1-21ddf7c628d-20220120T212233Z-avarab@gmail.com/
4. https://lore.kernel.org/git/xmqqlez8d2e6.fsf@gitster.g/

  parent reply	other threads:[~2022-01-22 12:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-20 16:51 [BUG] builtin/checkout.c:1098: should be able to skip past 'refs/heads/' Todd Zullinger
2022-01-20 17:04 ` Todd Zullinger
2022-01-20 21:26 ` [PATCH] checkout: fix BUG() case in 9081a421a6 Ævar Arnfjörð Bjarmason
2022-01-20 22:29   ` Junio C Hamano
2022-01-20 22:33     ` Junio C Hamano
2022-01-21 11:14     ` Ævar Arnfjörð Bjarmason
2022-01-21 14:29       ` Petr Šplíchal
2022-01-21 21:58         ` Todd Zullinger
2022-01-21 21:19       ` Junio C Hamano
2022-01-20 22:33   ` Todd Zullinger
2022-01-22  0:33   ` Junio C Hamano
2022-01-22  0:45   ` Junio C Hamano
2022-01-22  0:58     ` [PATCH] checkout: avoid BUG() when hitting a broken repository Junio C Hamano
2022-01-22  8:10       ` Johannes Sixt
2022-01-22 11:55       ` Ævar Arnfjörð Bjarmason [this message]
2022-01-23 16:38       ` Johannes Schindelin

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=220122.86y238ht7r.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=psplicha@redhat.com \
    --cc=tmz@pobox.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).