On 2023-07-15 at 04:26:46, Yuri wrote: > It stops in some intermediate state, and git still says that it is on the > main branch, but 'git checkout' deletes files that were added only in the > main branch, > > 'git reset --hard HEAD' fixes the main branch, bit now it is impossible to > switch to the other branch because it says that "some files would be > overwritten", which shouldn't be the case. > > > All operations should be atomic. This is impossible, since POSIX doesn't provide the functionality for us to perform operations atomically. There are various reasons, including permissions and files differing in case on a case-insensitive system, why an operation might not succeed part way through. > When the user presses Ctrl-C, the correct action would be to cleanly return > to the initial branch. I would disagree here. When the user has hit Ctrl-C, they want to interrupt the operation. That's literally why a SIGINT (interrupt) signal is sent. A checkout can take a long time, and the user will not want Git to perform an operation which will take even longer than the original one (because the original checkout was aborted). Even if we did that, the user could just hit Ctrl-C again and really interrupt the process, and then they'd be stuck again. If you don't want to interrupt the operation, then don't hit Ctrl-C. -- brian m. carlson (he/him or they/them) Toronto, Ontario, CA
Attachment:
signature.asc
Description: PGP signature