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