diff options
author | Jeff King <peff@peff.net> | 2016-12-06 23:25:21 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-12-07 01:16:53 +0300 |
commit | 9d4e28ead5bf133d014dfc9e9345f6bf083eefea (patch) | |
tree | c57aac1e945bec24e9f39b0a223a2a5ac1e5ec00 /t/t3903-stash.sh | |
parent | 05219a1276341e72d8082d76b7f5ed394b7437a4 (diff) |
stash: prefer plumbing over git-diff
When creating a stash, we need to look at the diff between
the working tree and HEAD, and do so using the git-diff
porcelain. Because git-diff enables porcelain config like
renames by default, this causes at least one problem. The
--name-only format will not mention the source side of a
rename, meaning we will fail to stash a deletion that is
part of a rename.
We could fix that case by passing --no-renames, but this is
a symptom of a larger problem. We should be using the
diff-index plumbing here, which does not have renames
enabled by default, and also does not respect any
potentially confusing config options.
Reported-by: Matthew Patey <matthew.patey2167@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3903-stash.sh')
-rwxr-xr-x | t/t3903-stash.sh | 9 |
1 files changed, 9 insertions, 0 deletions
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 |