File tree Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -344,9 +344,7 @@ apply_stash () {
344
344
345
345
assert_stash_like " $@ "
346
346
347
- git update-index -q --refresh &&
348
- git diff-files --quiet --ignore-submodules ||
349
- die ' Cannot apply to a dirty working tree, please stage your changes'
347
+ git update-index -q --refresh || die ' unable to refresh index'
350
348
351
349
# current index state
352
350
c_tree=$( git write-tree) ||
Original file line number Diff line number Diff line change @@ -37,14 +37,26 @@ test_expect_success 'parents of stash' '
37
37
test_cmp output expect
38
38
'
39
39
40
- test_expect_success ' apply needs clean working directory' '
41
- echo 4 > other-file &&
40
+ test_expect_success ' apply does not need clean working directory' '
41
+ echo 4 >other-file &&
42
42
git add other-file &&
43
- echo 5 > other-file &&
44
- test_must_fail git stash apply
43
+ echo 5 >other-file &&
44
+ git stash apply &&
45
+ echo 3 >expect &&
46
+ test_cmp expect file
47
+ '
48
+
49
+ test_expect_success ' apply does not clobber working directory changes' '
50
+ git reset --hard &&
51
+ echo 4 >file &&
52
+ test_must_fail git stash apply &&
53
+ echo 4 >expect &&
54
+ test_cmp expect file
45
55
'
46
56
47
57
test_expect_success ' apply stashed changes' '
58
+ git reset --hard &&
59
+ echo 5 >other-file &&
48
60
git add other-file &&
49
61
test_tick &&
50
62
git commit -m other-file &&
You can’t perform that action at this time.
0 commit comments