diff options
-rwxr-xr-x | git-stash.sh | 2 | ||||
-rwxr-xr-x | t/t3903-stash.sh | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/git-stash.sh b/git-stash.sh index c7509e8da4..0934481913 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -116,7 +116,7 @@ create_stash () { git read-tree --index-output="$TMPindex" -m $i_tree && GIT_INDEX_FILE="$TMPindex" && export GIT_INDEX_FILE && - git diff --name-only -z HEAD -- >"$TMP-stagenames" && + git diff-index --name-only -z HEAD -- >"$TMP-stagenames" && git update-index -z --add --remove --stdin <"$TMP-stagenames" && git write-tree && rm -f "$TMPindex" diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh index 2142c1fa92..ca2a6c1bcc 100755 --- a/t/t3903-stash.sh +++ b/t/t3903-stash.sh @@ -731,4 +731,13 @@ test_expect_success 'stash list --cc shows combined diff' ' test_cmp expect actual ' +test_expect_success 'stash is not confused by partial renames' ' + mv file renamed && + git add renamed && + git stash && + git stash apply && + test_path_is_file renamed && + test_path_is_missing file +' + test_done |