From: "Thomas Gummerer" <t.gummerer@gmail.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, Taylor Blau <me@ttaylorr.com>
Subject: Re: [PATCH] fetch --prune: exit with error if pruning fails
Date: Mon, 31 Jan 2022 13:07:33 +0000 [thread overview]
Message-ID: <87ilu0oxyi.fsf@coati.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <nycvar.QRO.7.76.6.2201281333410.347@tvgsbejvaqbjf.bet>
Johannes Schindelin writes:
> Hi Thomas,
>
> On Fri, 28 Jan 2022, Thomas Gummerer wrote:
>
>> Junio C Hamano writes:
>>
>> > Thomas Gummerer <t.gummerer@gmail.com> writes:
>> >
>> >> +test_expect_success REFFILES 'fetch --prune fails to delete branches' '
>> >> + cd "$D" &&
>> >> + git clone . prune-fail &&
>> >> + cd prune-fail &&
>> >> + git update-ref refs/remotes/origin/extrabranch main &&
>> >> + >.git/packed-refs.new &&
>> >> + test_must_fail git fetch --prune origin
>> >
>> > Is it because the lockfile ".new" on packed-refs prevents deletion
>> > of refs but does not block creation and updates to existing refs
>> > that it is an effective test for the "--prune" issue? If we somehow
>> > "locked" the whole ref updates, then the fetch would fail even
>> > without "--prune", so it may be "effective", but smells like knowing
>> > too much implementation detail. Yuck, but I do not offhand think of
>> > any better way (it is easier to think of worse ways), so without
>> > further input, I would say that this is the best (or "least bad") we
>> > can do.
>>
>> Yes, that's correct. New refs will be created as loose refs, so they
>> don't care about packed-refs. However deletions can potentially be
>> happening in packed-refs, and that's why it fails when 'packed-refs.new'
>> exists.
>>
>> I don't love the test either, but I also can't think of a better way to
>> do this.
>
> Maybe add a code comment about it? Something like:
>
> [...]
> : this will prevent --prune from locking packed-refs &&
> >.git/packed-refs.new &&
> [...]
Yeah, I think a comment here is a good idea, thanks!
next prev parent reply other threads:[~2022-01-31 13:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-27 15:37 [PATCH] fetch --prune: exit with error if pruning fails Thomas Gummerer
2022-01-27 19:57 ` Junio C Hamano
2022-01-28 10:13 ` Johannes Schindelin
2022-01-28 10:55 ` Thomas Gummerer
2022-01-28 12:36 ` Johannes Schindelin
2022-01-28 18:14 ` Junio C Hamano
2022-01-28 11:04 ` Thomas Gummerer
2022-01-28 12:34 ` Johannes Schindelin
2022-01-31 13:07 ` Thomas Gummerer [this message]
2022-01-31 13:30 ` [PATCH v2] " Thomas Gummerer
2022-01-31 19:20 ` Junio C Hamano
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=87ilu0oxyi.fsf@coati.i-did-not-set--mail-host-address--so-tickle-me \
--to=t.gummerer@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=me@ttaylorr.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).