t5304: restyle: trim empty lines, drop ':' before >
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Reviewed-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Han-Wen Nienhuys committed
May 31, 2021 at 16:56 UTC
1fa9cf6ea14eba36d72eb48e82069012c6c8af90
1 file changed
+20
-54
t/t5304-prune.sh
+20
-54
@@ -22,30 +22,25 @@ add_blob() {
22
}
23
24
test_expect_success setup '
25
-
26
- : > file &&
25
+ >file &&
26
git add file &&
27
test_tick &&
28
git commit -m initial &&
29
git gc
31
-
30
'
31
32
test_expect_success 'prune stale packs' '
35
-
33
orig_pack=$(echo .git/objects/pack/*.pack) &&
37
- : > .git/objects/tmp_1.pack &&
38
- : > .git/objects/tmp_2.pack &&
34
+ >.git/objects/tmp_1.pack &&
35
+ >.git/objects/tmp_2.pack &&
36
test-tool chmtime =-86501 .git/objects/tmp_1.pack &&
37
git prune --expire 1.day &&
38
test_path_is_file $orig_pack &&
39
test_path_is_file .git/objects/tmp_2.pack &&
40
test_path_is_missing .git/objects/tmp_1.pack
44
-
41
'
42
43
test_expect_success 'prune --expire' '
48
-
44
add_blob &&
45
git prune --expire=1.hour.ago &&
46
verbose test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
@@ -54,11 +49,9 @@ test_expect_success 'prune --expire' '
49
git prune --expire 1.day &&
50
verbose test $before = $(git count-objects | sed "s/ .*//") &&
51
test_path_is_missing $BLOB_FILE
57
-
52
'
53
54
test_expect_success 'gc: implicit prune --expire' '
61
-
55
add_blob &&
56
test-tool chmtime =-$((2*$week-30)) $BLOB_FILE &&
57
git gc &&
@@ -68,33 +61,25 @@ test_expect_success 'gc: implicit prune --expire' '
61
git gc &&
62
verbose test $before = $(git count-objects | sed "s/ .*//") &&
63
test_path_is_missing $BLOB_FILE
71
-
64
'
65
66
test_expect_success 'gc: refuse to start with invalid gc.pruneExpire' '
75
-
67
git config gc.pruneExpire invalid &&
68
test_must_fail git gc
78
-
69
'
70
71
test_expect_success 'gc: start with ok gc.pruneExpire' '
82
-
72
git config gc.pruneExpire 2.days.ago &&
73
git gc
85
-
74
'
75
76
test_expect_success 'prune: prune nonsense parameters' '
89
-
77
test_must_fail git prune garbage &&
78
test_must_fail git prune --- &&
79
test_must_fail git prune --no-such-option
93
-
80
'
81
82
test_expect_success 'prune: prune unreachable heads' '
97
-
83
git config core.logAllRefUpdates false &&
84
mv .git/logs .git/logs.old &&
85
: > file2 &&
@@ -104,11 +89,9 @@ test_expect_success 'prune: prune unreachable heads' '
89
git reset HEAD^ &&
90
git prune &&
91
test_must_fail git reset $tmp_head --
107
-
92
'
93
94
test_expect_success 'prune: do not prune detached HEAD with no reflog' '
111
-
95
git checkout --detach --quiet &&
96
git commit --allow-empty -m "detached commit" &&
97
# verify that there is no reflogs
@@ -116,75 +99,61 @@ test_expect_success 'prune: do not prune detached HEAD with no reflog' '
99
test_path_is_missing .git/logs &&
100
git prune -n >prune_actual &&
101
test_must_be_empty prune_actual
119
-
102
'
103
104
test_expect_success 'prune: prune former HEAD after checking out branch' '
123
-
105
head_oid=$(git rev-parse HEAD) &&
106
git checkout --quiet main &&
107
git prune -v >prune_actual &&
108
grep "$head_oid" prune_actual
128
-
109
'
110
111
test_expect_success 'prune: do not prune heads listed as an argument' '
132
-
133
- : > file2 &&
112
+ >file2 &&
113
git add file2 &&
114
git commit -m temporary &&
115
tmp_head=$(git rev-list -1 HEAD) &&
116
git reset HEAD^ &&
117
git prune -- $tmp_head &&
118
git reset $tmp_head --
140
-
119
'
120
121
test_expect_success 'gc --no-prune' '
144
-
122
add_blob &&
123
test-tool chmtime =-$((5001*$day)) $BLOB_FILE &&
124
git config gc.pruneExpire 2.days.ago &&
125
git gc --no-prune &&
126
verbose test 1 = $(git count-objects | sed "s/ .*//") &&
127
test_path_is_file $BLOB_FILE
151
-
128
'
129
130
test_expect_success 'gc respects gc.pruneExpire' '
155
-
131
git config gc.pruneExpire 5002.days.ago &&
132
git gc &&
133
test_path_is_file $BLOB_FILE &&
134
git config gc.pruneExpire 5000.days.ago &&
135
git gc &&
136
test_path_is_missing $BLOB_FILE
162
-
137
'
138
139
test_expect_success 'gc --prune=<date>' '
166
-
140
add_blob &&
141
test-tool chmtime =-$((5001*$day)) $BLOB_FILE &&
142
git gc --prune=5002.days.ago &&
143
test_path_is_file $BLOB_FILE &&
144
git gc --prune=5000.days.ago &&
145
test_path_is_missing $BLOB_FILE
173
-
146
'
147
148
test_expect_success 'gc --prune=never' '
177
-
149
add_blob &&
150
git gc --prune=never &&
151
test_path_is_file $BLOB_FILE &&
152
git gc --prune=now &&
153
test_path_is_missing $BLOB_FILE
183
-
154
'
155
156
test_expect_success 'gc respects gc.pruneExpire=never' '
187
-
157
git config gc.pruneExpire never &&
158
add_blob &&
159
git gc &&
@@ -192,17 +161,14 @@ test_expect_success 'gc respects gc.pruneExpire=never' '
161
git config gc.pruneExpire now &&
162
git gc &&
163
test_path_is_missing $BLOB_FILE
195
-
164
'
165
166
test_expect_success 'prune --expire=never' '
199
-
167
add_blob &&
168
git prune --expire=never &&
169
test_path_is_file $BLOB_FILE &&
170
git prune &&
171
test_path_is_missing $BLOB_FILE
205
-
172
'
173
174
test_expect_success 'gc: prune old objects after local clone' '
@@ -222,16 +188,16 @@ test_expect_success 'gc: prune old objects after local clone' '
188
test_expect_success 'garbage report in count-objects -v' '
189
test_when_finished "rm -f .git/objects/pack/fake*" &&
190
test_when_finished "rm -f .git/objects/pack/foo*" &&
225
- : >.git/objects/pack/foo &&
226
- : >.git/objects/pack/foo.bar &&
227
- : >.git/objects/pack/foo.keep &&
228
- : >.git/objects/pack/foo.pack &&
229
- : >.git/objects/pack/fake.bar &&
230
- : >.git/objects/pack/fake.keep &&
231
- : >.git/objects/pack/fake.pack &&
232
- : >.git/objects/pack/fake.idx &&
233
- : >.git/objects/pack/fake2.keep &&
234
- : >.git/objects/pack/fake3.idx &&
191
+ >.git/objects/pack/foo &&
192
+ >.git/objects/pack/foo.bar &&
193
+ >.git/objects/pack/foo.keep &&
194
+ >.git/objects/pack/foo.pack &&
195
+ >.git/objects/pack/fake.bar &&
196
+ >.git/objects/pack/fake.keep &&
197
+ >.git/objects/pack/fake.pack &&
198
+ >.git/objects/pack/fake.idx &&
199
+ >.git/objects/pack/fake2.keep &&
200
+ >.git/objects/pack/fake3.idx &&
201
git count-objects -v 2>stderr &&
202
grep "index file .git/objects/pack/fake.idx is too small" stderr &&
203
grep "^warning:" stderr | sort >actual &&
@@ -250,12 +216,12 @@ EOF
216
test_expect_success 'clean pack garbage with gc' '
217
test_when_finished "rm -f .git/objects/pack/fake*" &&
218
test_when_finished "rm -f .git/objects/pack/foo*" &&
253
- : >.git/objects/pack/foo.keep &&
254
- : >.git/objects/pack/foo.pack &&
255
- : >.git/objects/pack/fake.idx &&
256
- : >.git/objects/pack/fake2.keep &&
257
- : >.git/objects/pack/fake2.idx &&
258
- : >.git/objects/pack/fake3.keep &&
219
+ >.git/objects/pack/foo.keep &&
220
+ >.git/objects/pack/foo.pack &&
221
+ >.git/objects/pack/fake.idx &&
222
+ >.git/objects/pack/fake2.keep &&
223
+ >.git/objects/pack/fake2.idx &&
224
+ >.git/objects/pack/fake3.keep &&
225
git gc &&
226
git count-objects -v 2>stderr &&
227
grep "^warning:" stderr | sort >actual &&