Skip to content

Commit 07b9d9a

Browse files
committed
Merge branch 'js/stash-p-fix' into pu
* js/stash-p-fix: stash -p: (partially) fix bug concerning split hunks t3904: fix incorrect demonstration of a bug
2 parents b1a532a + 7723436 commit 07b9d9a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

builtin/stash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ static int stash_patch(struct stash_info *info, const struct pathspec *ps,
10341034
}
10351035

10361036
cp_diff_tree.git_cmd = 1;
1037-
argv_array_pushl(&cp_diff_tree.args, "diff-tree", "-p", "HEAD",
1037+
argv_array_pushl(&cp_diff_tree.args, "diff-tree", "-p", "-U1", "HEAD",
10381038
oid_to_hex(&info->w_tree), "--", NULL);
10391039
if (pipe_command(&cp_diff_tree, NULL, 0, out_patch, 0, NULL, 0)) {
10401040
ret = -1;

t/t3904-stash-patch.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ test_expect_success 'none of this moved HEAD' '
8989
verify_saved_head
9090
'
9191

92-
test_expect_failure 'stash -p with split hunk' '
92+
test_expect_success 'stash -p with split hunk' '
9393
git reset --hard &&
9494
cat >test <<-\EOF &&
9595
aaa
@@ -106,8 +106,8 @@ test_expect_failure 'stash -p with split hunk' '
106106
ccc
107107
EOF
108108
printf "%s\n" s n y q |
109-
test_might_fail git stash -p 2>error &&
110-
! test_must_be_empty error &&
109+
git stash -p 2>error &&
110+
test_must_be_empty error &&
111111
grep "added line 1" test &&
112112
! grep "added line 2" test
113113
'

0 commit comments

Comments
 (0)