From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Patrick Steinhardt <ps@pks.im>, git@vger.kernel.org
Subject: Re: [PATCH v2 1/4] t1400: Avoid touching refs on filesystem
Date: Mon, 9 Nov 2020 17:28:07 -0500 [thread overview]
Message-ID: <20201109222807.GB670413@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqqpn4mb9bv.fsf@gitster.c.googlers.com>
On Mon, Nov 09, 2020 at 11:48:20AM -0800, Junio C Hamano wrote:
> This is a tangent, but what makes this test doubly interesting is
> that "git update-ref -d HEAD" would have allowed us to make it a
> non-repository if HEAD were detached, and it seems that we do not
> require "--force" to do so. We probably should forbid removing HEAD
> that id detached without "--force", which is such a destructive
> operation.
Yeah, I'd agree that is a good direction (but it definitely is a tangent
that should come in a separate series).
> > 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
> > + test_must_fail git show-ref --verify -q HEAD
> > '
>
> This is an example of breaking the repository. I am not sure if the
> test_must_fail is a good replacement--it would fail even if you say
> "git show-ref --verify -q refs/heads/$branch" where $branch is a
> name of a branch that exists, no?
Perhaps we could more directly check that the repository is broken.
Coupled with the ceiling-limit from earlier in the script, then:
git rev-parse --git-dir
should fail. Maybe that reveals the intent of what we're expecting a
little more clearly (and more so than your "show-ref before and after
restoring HEAD" example does, in my opinion).
I do have to wonder if this test even cares about HEAD. Could it equally
well work on another symref, like refs/remotes/origin/HEAD?
-Peff
next prev parent reply other threads:[~2020-11-09 22:28 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 [this message]
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
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=20201109222807.GB670413@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).