'git stash' is not atomic: it leaves both an invalid stash and file changes
Yuri <[email protected]>
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <[email protected]> |
My repository had many untracked files that were accidentally added, one of them was 2GB. My first attempt failed: $ git stash push ../../ -m "all-accidentally-added" Saved working directory and index state On main: all-accidentally-added fatal: unable to generate diff for misc/linux-rl9-cuda13/libcuda.txt Two problems with this: 1. it didn't say why did it fail to generate diff. It should have said "fatal: unable to generate diff for misc/linux-rl9-cuda13/libcuda.txt: file is 2GB which is larger than the limit 1GB" 2. This command left both stash and file changes. If the command has failed, why does it leave stash then? After removing the large file 'git stash' still failed: $ git stash push ../../ -m "all-accidentally-added-final" Saved working directory and index state On main: all-accidentally-added-final error: patch too large Again: "patch too large" needs to specify the limit, and the transaction should be atomic. Please consider improving error messages to be more informative as for the reasons of failure. Also please consider making stash atomic. The stash that was left was obviously invalid because it didn't contain at least one file. Yuri