diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-02-15 15:18:13 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-02-15 15:18:13 -0800 |
commit | 984c8337de2e2d610d36426226c08a14b43af23f (patch) | |
tree | 22c009a85ad30d35ae2f58475801af1bb774e677 /t | |
parent | Merge branch 'jk/abort-clone-with-existing-dest' into maint (diff) | |
parent | stash: don't delete untracked files that match pathspec (diff) | |
download | tgif-984c8337de2e2d610d36426226c08a14b43af23f.tar.xz |
Merge branch 'tg/stash-with-pathspec-fix' into maint
"git stash -- <pathspec>" incorrectly blew away untracked files in
the directory that matched the pathspec, which has been corrected.
* tg/stash-with-pathspec-fix:
stash: don't delete untracked files that match pathspec
Diffstat (limited to 't')
-rwxr-xr-x | t/t3903-stash.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh index 39c7f2ebd7..aefde7b172 100755 --- a/t/t3903-stash.sh +++ b/t/t3903-stash.sh @@ -1064,4 +1064,36 @@ test_expect_success 'stash -k -- <pathspec> leaves unstaged files intact' ' test foo,bar = $(cat foo),$(cat bar) ' +test_expect_success 'stash -- <subdir> leaves untracked files in subdir intact' ' + git reset && + >subdir/untracked && + >subdir/tracked1 && + >subdir/tracked2 && + git add subdir/tracked* && + git stash -- subdir/ && + test_path_is_missing subdir/tracked1 && + test_path_is_missing subdir/tracked2 && + test_path_is_file subdir/untracked && + git stash pop && + test_path_is_file subdir/tracked1 && + test_path_is_file subdir/tracked2 && + test_path_is_file subdir/untracked +' + +test_expect_success 'stash -- <subdir> works with binary files' ' + git reset && + >subdir/untracked && + >subdir/tracked && + cp "$TEST_DIRECTORY"/test-binary-1.png subdir/tracked-binary && + git add subdir/tracked* && + git stash -- subdir/ && + test_path_is_missing subdir/tracked && + test_path_is_missing subdir/tracked-binary && + test_path_is_file subdir/untracked && + git stash pop && + test_path_is_file subdir/tracked && + test_path_is_file subdir/tracked-binary && + test_path_is_file subdir/untracked +' + test_done |