mirror of
https://github.com/git/git
synced 2024-11-04 16:17:49 +00:00
Merge branch 'aj/stash-staged-fix'
"git stash -S" did not handle binary files correctly, which has been corrected. * aj/stash-staged-fix: stash: fix "--staged" with binary files
This commit is contained in:
commit
90f6b5a597
2 changed files with 11 additions and 2 deletions
|
@ -1205,8 +1205,8 @@ static int stash_staged(struct stash_info *info, struct strbuf *out_patch,
|
|||
}
|
||||
|
||||
cp_diff_tree.git_cmd = 1;
|
||||
strvec_pushl(&cp_diff_tree.args, "diff-tree", "-p", "-U1", "HEAD",
|
||||
oid_to_hex(&info->w_tree), "--", NULL);
|
||||
strvec_pushl(&cp_diff_tree.args, "diff-tree", "-p", "--binary",
|
||||
"-U1", "HEAD", oid_to_hex(&info->w_tree), "--", NULL);
|
||||
if (pipe_command(&cp_diff_tree, NULL, 0, out_patch, 0, NULL, 0)) {
|
||||
ret = -1;
|
||||
goto done;
|
||||
|
|
|
@ -393,6 +393,15 @@ test_expect_success 'stash --staged' '
|
|||
test bar,bar4 = $(cat file),$(cat file2)
|
||||
'
|
||||
|
||||
test_expect_success 'stash --staged with binary file' '
|
||||
printf "\0" >file &&
|
||||
git add file &&
|
||||
git stash --staged &&
|
||||
git stash pop &&
|
||||
printf "\0" >expect &&
|
||||
test_cmp expect file
|
||||
'
|
||||
|
||||
test_expect_success 'dont assume push with non-option args' '
|
||||
test_must_fail git stash -q drop 2>err &&
|
||||
test_grep -e "subcommand wasn'\''t specified; '\''push'\'' can'\''t be assumed due to unexpected token '\''drop'\''" err
|
||||
|
|
Loading…
Reference in a new issue