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: Yuri <yuri@rawbw.com>, Git Mailing List <git@vger.kernel.org>
Subject: Re: 'git stash push' isn't atomic when Ctrl-C is pressed
Date: Thu, 27 Jan 2022 03:36:21 +0100	[thread overview]
Message-ID: <220127.86zgnhdhft.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <xmqqczkeozpx.fsf@gitster.g>


On Wed, Jan 26 2022, Junio C Hamano wrote:

> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> I understood this problem as being one where we do the ref work first,
>> which we could start a transaction for, the user then ctrl+c's after the
>> ref work is done, but before the working tree is updated.
>
> If the process is killed while the working tree is half updated,
> nothing you do with ref transaction will help.

This thread is about Ctrl+C, i.e. SIGINT, but presumably we'd use
sigchain_push_common() which covers that and various other signals.

Of course if you're talking about SIGKILL all bets are off.

>>> I suspect that the untold thinking behind your statement was that we
>>> should try not to discourage new users from asking, and I agree with
>>> the sentiment to a certain degree.  But at the same time, I think it
>>> is simply irresponsible to do so without distinguising between
>>> asking for something realistic and unrealistic.
>>
>> I must admit I'm not deeply familiar with builtin/stash.c in particular,
>
> Then you can try to be on the conservative side, perhaps, to avoid
> misleading less experienced folks next time?  Thanks.

I meant I'm not too familiar with details of how "git stash" interacts
with the working tree etc., which is part of what you brought up in your
reply.

But I was mainly commenting on what I think is a fairly straightforward
way to address the original report of wanting references rolled back on
SIGINT, i.e. to move it to the reference transaction API, and to have it
roll back changes in certain scenarios.

Of course it's possible that I'm just missing something, do you see a
reason for why having a signal handler be responsible for rolling back a
reference transaction wouldn't work?

  reply	other threads:[~2022-01-27  2:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-25 17:13 'git stash push' isn't atomic when Ctrl-C is pressed Yuri
2022-01-26 13:41 ` Ævar Arnfjörð Bjarmason
2022-01-26 16:09   ` John Cai
2022-01-26 17:30     ` Ævar Arnfjörð Bjarmason
2022-01-26 19:58   ` Junio C Hamano
2022-01-26 20:47     ` Ævar Arnfjörð Bjarmason
2022-01-26 23:15       ` Junio C Hamano
2022-01-27  2:36         ` Ævar Arnfjörð Bjarmason [this message]
2022-01-27 18:05           ` Junio C Hamano
2022-01-27  1:53       ` John Cai
2022-01-26 20:23 ` 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=220127.86zgnhdhft.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=yuri@rawbw.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).