summaryrefslogtreecommitdiff
path: root/t/t3903-stash.sh
diff options
context:
space:
mode:
authorThomas Gummerer <t.gummerer@gmail.com>2019-07-16 14:23:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-07-16 19:58:20 (GMT)
commitb932f6a5e8cdbb33eff4563fdfb1eae9ebf70a65 (patch)
tree5720cb6a46369f6b97e3a64960243ccadb2a19bf /t/t3903-stash.sh
parentb697d92f56511e804b8ba20ccbe7bdc85dc66810 (diff)
downloadgit-b932f6a5e8cdbb33eff4563fdfb1eae9ebf70a65.zip
git-b932f6a5e8cdbb33eff4563fdfb1eae9ebf70a65.tar.gz
git-b932f6a5e8cdbb33eff4563fdfb1eae9ebf70a65.tar.bz2
stash: fix handling removed files with --keep-index
git stash push --keep-index is supposed to keep all changes that have been added to the index, both in the index and on disk. Currently this doesn't behave correctly when a file is removed from the index. Instead of keeping it deleted on disk, --keep-index currently restores the file. Fix that behaviour by using 'git checkout' in no-overlay mode which can faithfully restore the index and working tree. This also simplifies the code. Note that this will overwrite untracked files if the untracked file has the same name as a file that has been deleted in the index. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3903-stash.sh')
-rwxr-xr-xt/t3903-stash.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index ea30d5f..151cd49 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -1216,4 +1216,11 @@ test_expect_success 'stash works when user.name and user.email are not set' '
)
'
+test_expect_success 'stash --keep-index with file deleted in index does not resurrect it on disk' '
+ test_commit to-remove to-remove &&
+ git rm to-remove &&
+ git stash --keep-index &&
+ test_path_is_missing to-remove
+'
+
test_done