Re: switch/checkout stops halfway when it fails to write tracking config
- From
- 井上司 <inoue.tsukasa.4@gmail.com>
- Date
- Oct 20, 2026, 06:33 UTC
- Message-ID
- <CAP8tz2JNxfOZC1W4gvGSJ-=AzY7iBADj_KtzWb4sawyqjQ0hHw@mail.gmail.com>
- In-Reply-To
- <xmqq8q3typsg.fsf@gitster.g>
Thanks for the reply.
I agree with your point. However, implementing full atomicity now would be a large change, for two reasons:
- push -u, clone and fetch continue even when writing the tracking config fails, but setup_tracking() calls exit() and aborts the process. - For full atomicity, we would need to undo the worktree, the ref and the config. We would also need to handle the die() calls in checkout.
So I propose to make setup_tracking() return an error instead of calling exit(), so that switch and checkout can behave like the other callers, and to leave full atomicity as a separate topic.
2026年10月20日(火) 13:11 Junio C Hamano <gitster@pobox.com>:
Show 10 quoted lines
> > 井上司 <inoue.tsukasa.4@gmail.com> writes: > > > 7. Next steps > > I would like to work on a fix. Should checkout finish the switch and only > > report the tracking error, or should it fail before touching the worktree? > > Either would be an improvement over the reported behaviour, but if > we can make it atomic "all-or-none" matter, that would be more > preferrable than switching without setting up the tracking.