diff options
author | Petr Baudis <pasky@ucw.cz> | 2013-06-28 17:05:32 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-07-01 14:23:24 -0700 |
commit | a73653130edd6a8977106d45a8092c09040f9132 (patch) | |
tree | c76de88cc20570b9555b6a41e3429deee29fd247 /t/t0022-crlf-rename.sh | |
parent | treat_directory(): do not declare submodules to be untracked (diff) | |
download | tgif-a73653130edd6a8977106d45a8092c09040f9132.tar.xz |
git stash: avoid data loss when "git stash save" kills a directory
"stash save" is about saving the local change to the working tree,
but also about restoring the state of the last commit to the working
tree. When a local change is to turn a non-directory to a directory,
in order to restore the non-directory, everything in the directory
needs to be removed.
Which is fine when running "git stash save --include-untracked",
but without that option, untracked, newly created files in the
directory will have to be discarded, if the state you are restoring
to has a non-directory at the same path as the directory.
Introduce a safety valve to fail the operation in such case, using
the "ls-files --killed" which was designed for this exact purpose.
The "stash save" is stopped when untracked files need to be
discarded because their leading path ceased to be a directory, and
the user is required to pass --force to really have the data
removed.
Signed-off-by: Petr Baudis <pasky@ucw.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0022-crlf-rename.sh')
0 files changed, 0 insertions, 0 deletions