@@ -8,22 +8,22 @@ test_description='Test git stash'
8
8
. ./test-lib.sh
9
9
10
10
test_expect_success ' stash some dirty working directory' '
11
- echo 1 >file &&
11
+ echo 1 > file &&
12
12
git add file &&
13
13
echo unrelated >other-file &&
14
14
git add other-file &&
15
15
test_tick &&
16
16
git commit -m initial &&
17
- echo 2 >file &&
17
+ echo 2 > file &&
18
18
git add file &&
19
- echo 3 >file &&
19
+ echo 3 > file &&
20
20
test_tick &&
21
21
git stash &&
22
22
git diff-files --quiet &&
23
23
git diff-index --cached --quiet HEAD
24
24
'
25
25
26
- cat > expect << EOF
26
+ cat > expect << EOF
27
27
diff --git a/file b/file
28
28
index 0cfbf08..00750ed 100644
29
29
--- a/file
35
35
36
36
test_expect_success ' parents of stash' '
37
37
test $(git rev-parse stash^) = $(git rev-parse HEAD) &&
38
- git diff stash^2..stash >output &&
38
+ git diff stash^2..stash > output &&
39
39
test_cmp expect output
40
40
'
41
41
@@ -74,7 +74,7 @@ test_expect_success 'apply stashed changes' '
74
74
75
75
test_expect_success ' apply stashed changes (including index)' '
76
76
git reset --hard HEAD^ &&
77
- echo 6 >other-file &&
77
+ echo 6 > other-file &&
78
78
git add other-file &&
79
79
test_tick &&
80
80
git commit -m other-file &&
@@ -99,12 +99,12 @@ test_expect_success 'stash drop complains of extra options' '
99
99
100
100
test_expect_success ' drop top stash' '
101
101
git reset --hard &&
102
- git stash list >expected &&
103
- echo 7 >file &&
102
+ git stash list > stashlist1 &&
103
+ echo 7 > file &&
104
104
git stash &&
105
105
git stash drop &&
106
- git stash list >actual &&
107
- test_cmp expected actual &&
106
+ git stash list > stashlist2 &&
107
+ test_cmp stashlist1 stashlist2 &&
108
108
git stash apply &&
109
109
test 3 = $(cat file) &&
110
110
test 1 = $(git show :file) &&
@@ -113,9 +113,9 @@ test_expect_success 'drop top stash' '
113
113
114
114
test_expect_success ' drop middle stash' '
115
115
git reset --hard &&
116
- echo 8 >file &&
116
+ echo 8 > file &&
117
117
git stash &&
118
- echo 9 >file &&
118
+ echo 9 > file &&
119
119
git stash &&
120
120
git stash drop stash@{1} &&
121
121
test 2 = $(git stash list | wc -l) &&
@@ -160,7 +160,7 @@ test_expect_success 'stash pop' '
160
160
test 0 = $(git stash list | wc -l)
161
161
'
162
162
163
- cat > expect << EOF
163
+ cat > expect << EOF
164
164
diff --git a/file2 b/file2
165
165
new file mode 100644
166
166
index 0000000..1fe912c
@@ -170,7 +170,7 @@ index 0000000..1fe912c
170
170
+bar2
171
171
EOF
172
172
173
- cat > expect1 << EOF
173
+ cat > expect1 << EOF
174
174
diff --git a/file b/file
175
175
index 257cc56..5716ca5 100644
176
176
--- a/file
@@ -180,7 +180,7 @@ index 257cc56..5716ca5 100644
180
180
+bar
181
181
EOF
182
182
183
- cat > expect2 << EOF
183
+ cat > expect2 << EOF
184
184
diff --git a/file b/file
185
185
index 7601807..5716ca5 100644
186
186
--- a/file
@@ -198,79 +198,79 @@ index 0000000..1fe912c
198
198
EOF
199
199
200
200
test_expect_success ' stash branch' '
201
- echo foo >file &&
201
+ echo foo > file &&
202
202
git commit file -m first &&
203
- echo bar >file &&
204
- echo bar2 >file2 &&
203
+ echo bar > file &&
204
+ echo bar2 > file2 &&
205
205
git add file2 &&
206
206
git stash &&
207
- echo baz >file &&
207
+ echo baz > file &&
208
208
git commit file -m second &&
209
209
git stash branch stashbranch &&
210
210
test refs/heads/stashbranch = $(git symbolic-ref HEAD) &&
211
211
test $(git rev-parse HEAD) = $(git rev-parse master^) &&
212
- git diff --cached >output &&
212
+ git diff --cached > output &&
213
213
test_cmp expect output &&
214
- git diff >output &&
214
+ git diff > output &&
215
215
test_cmp expect1 output &&
216
216
git add file &&
217
217
git commit -m alternate\ second &&
218
- git diff master..stashbranch >output &&
218
+ git diff master..stashbranch > output &&
219
219
test_cmp output expect2 &&
220
220
test 0 = $(git stash list | wc -l)
221
221
'
222
222
223
223
test_expect_success ' apply -q is quiet' '
224
- echo foo >file &&
224
+ echo foo > file &&
225
225
git stash &&
226
- git stash apply -q >output.out 2>&1 &&
226
+ git stash apply -q > output.out 2>&1 &&
227
227
test_must_be_empty output.out
228
228
'
229
229
230
230
test_expect_success ' save -q is quiet' '
231
- git stash save --quiet >output.out 2>&1 &&
231
+ git stash save --quiet > output.out 2>&1 &&
232
232
test_must_be_empty output.out
233
233
'
234
234
235
235
test_expect_success ' pop -q is quiet' '
236
- git stash pop -q >output.out 2>&1 &&
236
+ git stash pop -q > output.out 2>&1 &&
237
237
test_must_be_empty output.out
238
238
'
239
239
240
240
test_expect_success ' pop -q --index works and is quiet' '
241
- echo foo >file &&
241
+ echo foo > file &&
242
242
git add file &&
243
243
git stash save --quiet &&
244
- git stash pop -q --index >output.out 2>&1 &&
244
+ git stash pop -q --index > output.out 2>&1 &&
245
245
test foo = "$(git show :file)" &&
246
246
test_must_be_empty output.out
247
247
'
248
248
249
249
test_expect_success ' drop -q is quiet' '
250
250
git stash &&
251
- git stash drop -q >output.out 2>&1 &&
251
+ git stash drop -q > output.out 2>&1 &&
252
252
test_must_be_empty output.out
253
253
'
254
254
255
255
test_expect_success ' stash -k' '
256
- echo bar3 >file &&
257
- echo bar4 >file2 &&
256
+ echo bar3 > file &&
257
+ echo bar4 > file2 &&
258
258
git add file2 &&
259
259
git stash -k &&
260
260
test bar,bar4 = $(cat file),$(cat file2)
261
261
'
262
262
263
263
test_expect_success ' stash --no-keep-index' '
264
- echo bar33 >file &&
265
- echo bar44 >file2 &&
264
+ echo bar33 > file &&
265
+ echo bar44 > file2 &&
266
266
git add file2 &&
267
267
git stash --no-keep-index &&
268
268
test bar,bar2 = $(cat file),$(cat file2)
269
269
'
270
270
271
271
test_expect_success ' stash --invalid-option' '
272
- echo bar5 >file &&
273
- echo bar6 >file2 &&
272
+ echo bar5 > file &&
273
+ echo bar6 > file2 &&
274
274
git add file2 &&
275
275
test_must_fail git stash --invalid-option &&
276
276
test_must_fail git stash save --invalid-option &&
@@ -486,28 +486,26 @@ test_expect_success 'stash branch - no stashes on stack, stash-like argument' '
486
486
git stash clear &&
487
487
test_when_finished "git reset --hard HEAD" &&
488
488
git reset --hard &&
489
- echo foo >>file &&
489
+ echo foo >> file &&
490
490
STASH_ID=$(git stash create) &&
491
491
git reset --hard &&
492
492
git stash branch stash-branch ${STASH_ID} &&
493
- test_when_finished "git reset --hard HEAD && git checkout master &&
494
- git branch -D stash-branch" &&
493
+ test_when_finished "git reset --hard HEAD && git checkout master && git branch -D stash-branch" &&
495
494
test $(git ls-files --modified | wc -l) -eq 1
496
495
'
497
496
498
497
test_expect_success ' stash branch - stashes on stack, stash-like argument' '
499
498
git stash clear &&
500
499
test_when_finished "git reset --hard HEAD" &&
501
500
git reset --hard &&
502
- echo foo >>file &&
501
+ echo foo >> file &&
503
502
git stash &&
504
503
test_when_finished "git stash drop" &&
505
- echo bar >>file &&
504
+ echo bar >> file &&
506
505
STASH_ID=$(git stash create) &&
507
506
git reset --hard &&
508
507
git stash branch stash-branch ${STASH_ID} &&
509
- test_when_finished "git reset --hard HEAD && git checkout master &&
510
- git branch -D stash-branch" &&
508
+ test_when_finished "git reset --hard HEAD && git checkout master && git branch -D stash-branch" &&
511
509
test $(git ls-files --modified | wc -l) -eq 1
512
510
'
513
511
@@ -520,10 +518,10 @@ test_expect_success 'stash show format defaults to --stat' '
520
518
git stash clear &&
521
519
test_when_finished "git reset --hard HEAD" &&
522
520
git reset --hard &&
523
- echo foo >>file &&
521
+ echo foo >> file &&
524
522
git stash &&
525
523
test_when_finished "git stash drop" &&
526
- echo bar >>file &&
524
+ echo bar >> file &&
527
525
STASH_ID=$(git stash create) &&
528
526
git reset --hard &&
529
527
cat >expected <<-EOF &&
@@ -538,10 +536,10 @@ test_expect_success 'stash show - stashes on stack, stash-like argument' '
538
536
git stash clear &&
539
537
test_when_finished "git reset --hard HEAD" &&
540
538
git reset --hard &&
541
- echo foo >>file &&
539
+ echo foo >> file &&
542
540
git stash &&
543
541
test_when_finished "git stash drop" &&
544
- echo bar >>file &&
542
+ echo bar >> file &&
545
543
STASH_ID=$(git stash create) &&
546
544
git reset --hard &&
547
545
echo "1 0 file" >expected &&
@@ -553,10 +551,10 @@ test_expect_success 'stash show -p - stashes on stack, stash-like argument' '
553
551
git stash clear &&
554
552
test_when_finished "git reset --hard HEAD" &&
555
553
git reset --hard &&
556
- echo foo >>file &&
554
+ echo foo >> file &&
557
555
git stash &&
558
556
test_when_finished "git stash drop" &&
559
- echo bar >>file &&
557
+ echo bar >> file &&
560
558
STASH_ID=$(git stash create) &&
561
559
git reset --hard &&
562
560
cat >expected <<-EOF &&
@@ -576,7 +574,7 @@ test_expect_success 'stash show - no stashes on stack, stash-like argument' '
576
574
git stash clear &&
577
575
test_when_finished "git reset --hard HEAD" &&
578
576
git reset --hard &&
579
- echo foo >>file &&
577
+ echo foo >> file &&
580
578
STASH_ID=$(git stash create) &&
581
579
git reset --hard &&
582
580
echo "1 0 file" >expected &&
@@ -588,7 +586,7 @@ test_expect_success 'stash show -p - no stashes on stack, stash-like argument' '
588
586
git stash clear &&
589
587
test_when_finished "git reset --hard HEAD" &&
590
588
git reset --hard &&
591
- echo foo >>file &&
589
+ echo foo >> file &&
592
590
STASH_ID=$(git stash create) &&
593
591
git reset --hard &&
594
592
cat >expected <<-EOF &&
@@ -608,9 +606,9 @@ test_expect_success 'stash drop - fail early if specified stash is not a stash r
608
606
git stash clear &&
609
607
test_when_finished "git reset --hard HEAD && git stash clear" &&
610
608
git reset --hard &&
611
- echo foo >file &&
609
+ echo foo > file &&
612
610
git stash &&
613
- echo bar >file &&
611
+ echo bar > file &&
614
612
git stash &&
615
613
test_must_fail git stash drop $(git rev-parse stash@{0}) &&
616
614
git stash pop &&
@@ -622,9 +620,9 @@ test_expect_success 'stash pop - fail early if specified stash is not a stash re
622
620
git stash clear &&
623
621
test_when_finished "git reset --hard HEAD && git stash clear" &&
624
622
git reset --hard &&
625
- echo foo >file &&
623
+ echo foo > file &&
626
624
git stash &&
627
- echo bar >file &&
625
+ echo bar > file &&
628
626
git stash &&
629
627
test_must_fail git stash pop $(git rev-parse stash@{0}) &&
630
628
git stash pop &&
@@ -634,8 +632,8 @@ test_expect_success 'stash pop - fail early if specified stash is not a stash re
634
632
635
633
test_expect_success ' ref with non-existent reflog' '
636
634
git stash clear &&
637
- echo bar5 >file &&
638
- echo bar6 >file2 &&
635
+ echo bar5 > file &&
636
+ echo bar6 > file2 &&
639
637
git add file2 &&
640
638
git stash &&
641
639
test_must_fail git rev-parse --quiet --verify does-not-exist &&
@@ -655,8 +653,8 @@ test_expect_success 'ref with non-existent reflog' '
655
653
test_expect_success ' invalid ref of the form stash@{n}, n >= N' '
656
654
git stash clear &&
657
655
test_must_fail git stash drop stash@{0} &&
658
- echo bar5 >file &&
659
- echo bar6 >file2 &&
656
+ echo bar5 > file &&
657
+ echo bar6 > file2 &&
660
658
git add file2 &&
661
659
git stash &&
662
660
test_must_fail git stash drop stash@{1} &&
@@ -726,7 +724,7 @@ test_expect_success 'stash apply shows status same as git status (relative to cu
726
724
test_i18ncmp expect actual
727
725
'
728
726
729
- cat > expect << EOF
727
+ cat > expect << EOF
730
728
diff --git a/HEAD b/HEAD
731
729
new file mode 100644
732
730
index 0000000..fe0cbee
@@ -739,14 +737,14 @@ EOF
739
737
test_expect_success ' stash where working directory contains "HEAD" file' '
740
738
git stash clear &&
741
739
git reset --hard &&
742
- echo file-not-a-ref >HEAD &&
740
+ echo file-not-a-ref > HEAD &&
743
741
git add HEAD &&
744
742
test_tick &&
745
743
git stash &&
746
744
git diff-files --quiet &&
747
745
git diff-index --cached --quiet HEAD &&
748
746
test "$(git rev-parse stash^)" = "$(git rev-parse HEAD)" &&
749
- git diff stash^..stash >output &&
747
+ git diff stash^..stash > output &&
750
748
test_cmp expect output
751
749
'
752
750
0 commit comments