git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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: Fri, 28 Jan 2022 10:55:41 +0000	[thread overview]
Message-ID: <87pmocp1si.fsf@coati.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <nycvar.QRO.7.76.6.2201281110050.347@tvgsbejvaqbjf.bet>


Johannes Schindelin writes:

> Hi Junio,
>
> On Thu, 27 Jan 2022, Junio C Hamano wrote:
>
>> Thomas Gummerer <t.gummerer@gmail.com> writes:
>>
>> > +		if (retcode) {
>> > +			free_refs(ref_map);
>> > +			goto cleanup;
>> >  		}
>>
>> This part is iffy.  We tried to prune refs, we may have removed some
>> of the refs missing from the other side but we may still have some
>> other refs that are missing from the other side due to the failure
>> we noticed.
>>
>> Is it sensible to abort the fetching?  I am undecided, but without
>> further input, my gut reaction is that it is safe and may even be
>> better to treat this as a soft error and try to go closer to where
>> the user wanted to go as much as possible by continuing to fetch
>> from the other side, given that we have already paid for the cost of
>> discovering the refs from the other side.

> I am not so sure. When pruning failed, there may very well be directories
> or files in the way of fetching the refs as desired. And it might be even
> worse if pruning failed _without_ the fetch failing afterwards: the user
> specifically asked for stale refs to be cleaned up, the command succeeded,
> but did not do what the user asked for.

I was thinking along similar lines here.  I was going back and forth
between letting the fetch continue, and then exiting with a non-zero
exit code, and just erroring out directly.  I ended up with the latter
because it felt like the right thing to do for the user.  The command
failed, so I'd think it's more confusing that it does more work after
that (even if we already did part of that work).

But I don't care too much one way or another, as long as we end up with
a non-zero exit code when the fetch fails.

> Maybe Thomas has an even stronger argument in favor of erroring out. In
> any case, I don't think that `--prune` should be a "best effort, otherwise
> just shrug" option. If we wanted that, we could introduce
> `--prune-best-effort` or some such...

I don't have a strong argument on whether we should error out
immediately after failing to prune the refs, or just erroring out after
doing the rest of the work, other than exiting early feels right to me.

From the comments upthread it seems to me that the argument is more
whether we should continue after failing to prune, and exit with a
non-zero exit code, or if we should just fail early.

Though I'm happy to introduce a '--prune-best-effort' option or
something like that if we still want to preserve that option for users.
I don't really see people wanting to use that though, and it should be
very rare that '--prune' fails, but the rest of the fetch succeeds.

  reply	other threads:[~2022-01-28 10:55 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 [this message]
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
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pmocp1si.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.
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).