From: Jeff King <peff@peff.net>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH v3 1/4] t1400: avoid touching refs on filesystem
Date: Wed, 11 Nov 2020 18:06:59 -0500 [thread overview]
Message-ID: <20201111230659.GA632312@coredump.intra.peff.net> (raw)
In-Reply-To: <e66b1bcc62139f62866dc9f25856eaebfe107056.1605077740.git.ps@pks.im>
On Wed, Nov 11, 2020 at 07:58:38AM +0100, Patrick Steinhardt wrote:
> The testcase t1400 exercises the git-update-ref(1) utility. To do so,
> many tests directly read and write references via the filesystem,
> assuming that we always use loose and/or packed references. While this
> is true now, it'll change with the introduction of the reftable backend.
>
> Convert those tests to use git-update-ref(1) and git-show-ref(1) where
> possible. As some tests exercise behaviour with broken references and
> neither of those tools actually allows writing or reading broken
> references, this commit doesn't adjust all tests.
Do you want to mention the switch away from using HEAD in some tests
here?
> +# Some of the tests delete HEAD, which causes us to not treat the current
> +# working directory as a Git repository anymore. To avoid using any potential
> +# parent repository to be discovered, we need to set up the ceiling directories.
> +GIT_CEILING_DIRECTORIES="$PWD/.."
> +export GIT_CEILING_DIRECTORIES
Do we still need this, now that we're not deleting HEAD? I think we do
still delete a branch via HEAD, but that should leave an unborn branch,
which is still a valid repo.
> test_expect_success "deleting current branch adds message to HEAD's log" '
> - test_when_finished "rm -f .git/$m" &&
> + test_when_finished "git update-ref -d $m" &&
> git update-ref $m $A &&
> git symbolic-ref HEAD $m &&
> git update-ref -m delete-$m -d $m &&
> - test_path_is_missing .git/$m &&
> + test_must_fail git show-ref --verify -q $m &&
> grep "delete-$m$" .git/logs/HEAD
> '
E.g., these ones should leave a valid repo (and must remain HEAD,
because it's special for reflogging).
> -cp -f .git/HEAD .git/HEAD.orig
> test_expect_success 'delete symref without dereference' '
> - test_when_finished "cp -f .git/HEAD.orig .git/HEAD" &&
> - git update-ref --no-deref -d HEAD &&
> - test_path_is_missing .git/HEAD
> + git symbolic-ref SYMREF $m &&
> + git update-ref --no-deref -d SYMREF &&
> + test_must_fail git show-ref --verify -q SYMREF
> '
And now this one is safe. Good.
I wonder, though...is it still testing the same thing as the original?
This is not related to the use of SYMREF vs HEAD, but wouldn't show-ref
similarly fail if we had deleted $m, but left SYMREF in place (i.e., if
--no-deref didn't actually do anything)?
Perhaps this would be better:
# confirm that the pointed-to ref is still there
git show-ref --verify $m &&
# but our symref is not
test_must_fail git show-ref --verify SYMREF &&
test_must_fail git symbolic-ref SYMREF
> test_expect_success 'delete symref without dereference when the referred ref is packed' '
> - test_when_finished "cp -f .git/HEAD.orig .git/HEAD" &&
> echo foo >foo.c &&
> git add foo.c &&
> git commit -m foo &&
> + git symbolic-ref SYMREF $m &&
> git pack-refs --all &&
> - git update-ref --no-deref -d HEAD &&
> - test_path_is_missing .git/HEAD
> + git update-ref --no-deref -d SYMREF &&
> + test_must_fail git show-ref --verify -q SYMREF
> '
Likewise here.
-Peff
next prev parent reply other threads:[~2020-11-12 1:32 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-04 14:57 [PATCH 0/2] update-ref: Allow creation of multiple transactions Patrick Steinhardt
2020-11-04 14:57 ` [PATCH 1/2] " Patrick Steinhardt
2020-11-05 19:29 ` Jeff King
2020-11-05 21:34 ` Junio C Hamano
2020-11-06 17:52 ` Jeff King
2020-11-06 19:30 ` Junio C Hamano
2020-11-06 6:36 ` Patrick Steinhardt
2020-11-04 14:57 ` [PATCH 2/2] p1400: Use `git-update-ref --stdin` to test " Patrick Steinhardt
2020-11-05 19:34 ` Jeff King
2020-11-09 10:06 ` [PATCH v2 0/4] update-ref: Allow creation of " Patrick Steinhardt
2020-11-09 10:06 ` [PATCH v2 1/4] t1400: Avoid touching refs on filesystem Patrick Steinhardt
2020-11-09 19:48 ` Junio C Hamano
2020-11-09 22:28 ` Jeff King
2020-11-10 12:34 ` Patrick Steinhardt
2020-11-10 17:04 ` Junio C Hamano
2020-11-09 10:06 ` [PATCH v2 2/4] update-ref: Allow creation of multiple transactions Patrick Steinhardt
2020-11-09 10:06 ` [PATCH v2 3/4] p1400: Use `git-update-ref --stdin` to test " Patrick Steinhardt
2020-11-09 10:07 ` [PATCH v2 4/4] update-ref: Disallow restart of ongoing transactions Patrick Steinhardt
2020-11-09 19:53 ` Junio C Hamano
2020-11-09 22:33 ` [PATCH v2 0/4] update-ref: Allow creation of multiple transactions Jeff King
2020-11-09 22:38 ` Junio C Hamano
2020-11-11 6:58 ` [PATCH v3 0/4] update-ref: allow " Patrick Steinhardt
2020-11-11 6:58 ` [PATCH v3 1/4] t1400: avoid touching refs on filesystem Patrick Steinhardt
2020-11-11 9:04 ` SZEDER Gábor
2020-11-11 10:00 ` Patrick Steinhardt
2020-11-11 10:24 ` SZEDER Gábor
2020-11-11 23:06 ` Jeff King [this message]
2020-11-13 8:08 ` Patrick Steinhardt
2020-11-11 6:58 ` [PATCH v3 2/4] update-ref: allow creation of multiple transactions Patrick Steinhardt
2020-11-11 6:58 ` [PATCH v3 3/4] p1400: use `git-update-ref --stdin` to test " Patrick Steinhardt
2020-11-11 6:58 ` [PATCH v3 4/4] update-ref: disallow "start" for ongoing transactions Patrick Steinhardt
2020-11-13 8:12 ` [PATCH v4 0/4] update-ref: allow creation of multiple transactions Patrick Steinhardt
2020-11-13 8:12 ` [PATCH v4 1/4] t1400: avoid touching refs on filesystem Patrick Steinhardt
2020-11-13 20:40 ` Jeff King
2020-11-18 6:48 ` Patrick Steinhardt
2020-11-18 7:02 ` Junio C Hamano
2020-11-13 8:12 ` [PATCH v4 2/4] update-ref: allow creation of multiple transactions Patrick Steinhardt
2020-11-13 8:12 ` [PATCH v4 3/4] p1400: use `git-update-ref --stdin` to test " Patrick Steinhardt
2020-11-13 8:12 ` [PATCH v4 4/4] update-ref: disallow "start" for ongoing transactions Patrick Steinhardt
2020-11-25 22:37 ` [PATCH v4 0/4] update-ref: allow creation of multiple transactions Junio C Hamano
2020-11-26 0:42 ` 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
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=20201111230659.GA632312@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ps@pks.im \
/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).