Re: 'git stash push' isn't atomic when Ctrl-C is pressed
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Jan 26, 2022, 13:41 UTC
- Message-ID
- <220126.86bkzyfw3q.gmgdl@evledraar.gmail.com>
- In-Reply-To
- <4493bcea-c7dd-da0a-e811-83044b3a1cac@tsoft.com>
On Tue, Jan 25 2022, Yuri wrote:
Show 5 quoted lines
> Ctrl-C was pressed in the middle. git creates the stash record and > didn't update the files. > > > Expected behavior: Ctrl-C should cleanly roll back the operation.
Yes, you're right. It really should be fixed.
It's a known issue with builtin/stash.c being written in C, but really only still being a faithful conversion of the code we had in a git-stash.sh shellscript until relatively recently.
(No fault of those doing the conversion, that's always the logical first step).
So it modifies various refs, reflogs etc., but does so mostly via shelling out to other git commands, whereas it really should be moved to using the ref transaction API.
Ig you or anyone else is interested in would be a most welcome project to work on...