@@ -21,14 +21,15 @@ test_expect_success setup '
21
21
i=0 &&
22
22
while test $i -le $cnt
23
23
do
24
- i=$(($i+1)) &&
25
- test_tick &&
26
- echo "Commit #$i" >mozart/is/pink &&
27
- git update-index --add mozart/is/pink &&
28
- tree=$(git write-tree) &&
29
- commit=$(echo "Commit #$i" | git commit-tree $tree -p $parent) &&
30
- git update-ref refs/tags/commit$i $commit &&
31
- parent=$commit || return 1
24
+ i=$(($i+1)) &&
25
+ test_tick &&
26
+ echo "Commit #$i" >mozart/is/pink &&
27
+ git update-index --add mozart/is/pink &&
28
+ tree=$(git write-tree) &&
29
+ commit=$(echo "Commit #$i" |
30
+ git commit-tree $tree -p $parent) &&
31
+ git update-ref refs/tags/commit$i $commit &&
32
+ parent=$commit || return 1
32
33
done &&
33
34
git update-ref HEAD "$commit" &&
34
35
git clone ./. victim &&
@@ -38,14 +39,14 @@ test_expect_success setup '
38
39
i=0 &&
39
40
while test $i -le $cnt
40
41
do
41
- i=$(($i+1)) &&
42
- test_tick &&
43
- echo "Rebase #$i" >mozart/is/pink &&
44
- git update-index --add mozart/is/pink &&
45
- tree=$(git write-tree) &&
46
- commit=$(echo "Rebase #$i" | git commit-tree $tree -p $parent) &&
47
- git update-ref refs/tags/rebase$i $commit &&
48
- parent=$commit || return 1
42
+ i=$(($i+1)) &&
43
+ test_tick &&
44
+ echo "Rebase #$i" >mozart/is/pink &&
45
+ git update-index --add mozart/is/pink &&
46
+ tree=$(git write-tree) &&
47
+ commit=$(echo "Rebase #$i" | git commit-tree $tree -p $parent) &&
48
+ git update-ref refs/tags/rebase$i $commit &&
49
+ parent=$commit || return 1
49
50
done &&
50
51
git update-ref HEAD "$commit" &&
51
52
echo Rebase &&
@@ -57,11 +58,11 @@ test_expect_success 'pack the source repository' '
57
58
'
58
59
59
60
test_expect_success ' pack the destination repository' '
60
- (
61
- cd victim &&
62
- git repack -a -d &&
63
- git prune
64
- )
61
+ (
62
+ cd victim &&
63
+ git repack -a -d &&
64
+ git prune
65
+ )
65
66
'
66
67
67
68
test_expect_success ' refuse pushing rewound head without --force' '
@@ -85,10 +86,10 @@ test_expect_success 'push can be used to delete a ref' '
85
86
86
87
test_expect_success ' refuse deleting push with denyDeletes' '
87
88
(
88
- cd victim &&
89
- test_might_fail git branch -D extra &&
90
- git config receive.denyDeletes true &&
91
- git branch extra master
89
+ cd victim &&
90
+ test_might_fail git branch -D extra &&
91
+ git config receive.denyDeletes true &&
92
+ git branch extra master
92
93
) &&
93
94
test_must_fail git send-pack ./victim :extra master
94
95
'
@@ -118,9 +119,9 @@ test_expect_success 'override denyDeletes with git -c receive-pack' '
118
119
119
120
test_expect_success ' denyNonFastforwards trumps --force' '
120
121
(
121
- cd victim &&
122
- test_might_fail git branch -D extra &&
123
- git config receive.denyNonFastforwards true
122
+ cd victim &&
123
+ test_might_fail git branch -D extra &&
124
+ git config receive.denyNonFastforwards true
124
125
) &&
125
126
victim_orig=$(cd victim && git rev-parse --verify master) &&
126
127
test_must_fail git send-pack --force ./victim master^:master &&
@@ -143,50 +144,50 @@ test_expect_success 'send-pack --all sends all branches' '
143
144
test_expect_success ' push --all excludes remote-tracking hierarchy' '
144
145
mkdir parent &&
145
146
(
146
- cd parent &&
147
- git init && : >file && git add file && git commit -m add
147
+ cd parent &&
148
+ git init && : >file && git add file && git commit -m add
148
149
) &&
149
150
git clone parent child &&
150
151
(
151
- cd child && git push --all
152
+ cd child && git push --all
152
153
) &&
153
154
(
154
- cd parent &&
155
- test -z "$(git for-each-ref refs/remotes/origin)"
155
+ cd parent &&
156
+ test -z "$(git for-each-ref refs/remotes/origin)"
156
157
)
157
158
'
158
159
159
160
test_expect_success ' receive-pack runs auto-gc in remote repo' '
160
161
rm -rf parent child &&
161
162
git init parent &&
162
163
(
163
- # Setup a repo with 2 packs
164
- cd parent &&
165
- echo "Some text" >file.txt &&
166
- git add . &&
167
- git commit -m "Initial commit" &&
168
- git repack -adl &&
169
- echo "Some more text" >>file.txt &&
170
- git commit -a -m "Second commit" &&
171
- git repack
164
+ # Setup a repo with 2 packs
165
+ cd parent &&
166
+ echo "Some text" >file.txt &&
167
+ git add . &&
168
+ git commit -m "Initial commit" &&
169
+ git repack -adl &&
170
+ echo "Some more text" >>file.txt &&
171
+ git commit -a -m "Second commit" &&
172
+ git repack
172
173
) &&
173
174
cp -R parent child &&
174
175
(
175
- # Set the child to auto-pack if more than one pack exists
176
- cd child &&
177
- git config gc.autopacklimit 1 &&
178
- git config gc.autodetach false &&
179
- git branch test_auto_gc &&
180
- # And create a file that follows the temporary object naming
181
- # convention for the auto-gc to remove
182
- : >.git/objects/tmp_test_object &&
183
- test-tool chmtime =-1209601 .git/objects/tmp_test_object
176
+ # Set the child to auto-pack if more than one pack exists
177
+ cd child &&
178
+ git config gc.autopacklimit 1 &&
179
+ git config gc.autodetach false &&
180
+ git branch test_auto_gc &&
181
+ # And create a file that follows the temporary object naming
182
+ # convention for the auto-gc to remove
183
+ : >.git/objects/tmp_test_object &&
184
+ test-tool chmtime =-1209601 .git/objects/tmp_test_object
184
185
) &&
185
186
(
186
- cd parent &&
187
- echo "Even more text" >>file.txt &&
188
- git commit -a -m "Third commit" &&
189
- git send-pack ../child HEAD:refs/heads/test_auto_gc
187
+ cd parent &&
188
+ echo "Even more text" >>file.txt &&
189
+ git commit -a -m "Third commit" &&
190
+ git send-pack ../child HEAD:refs/heads/test_auto_gc
190
191
) &&
191
192
test ! -e child/.git/objects/tmp_test_object
192
193
'
@@ -195,32 +196,32 @@ rewound_push_setup() {
195
196
rm -rf parent child &&
196
197
mkdir parent &&
197
198
(
198
- cd parent &&
199
- git init &&
200
- echo one > file && git add file && git commit -m one &&
201
- git config receive.denyCurrentBranch warn &&
202
- echo two > file && git commit -a -m two
199
+ cd parent &&
200
+ git init &&
201
+ echo one > file && git add file && git commit -m one &&
202
+ git config receive.denyCurrentBranch warn &&
203
+ echo two > file && git commit -a -m two
203
204
) &&
204
205
git clone parent child &&
205
206
(
206
- cd child && git reset --hard HEAD^
207
+ cd child && git reset --hard HEAD^
207
208
)
208
209
}
209
210
210
211
test_expect_success ' pushing explicit refspecs respects forcing' '
211
212
rewound_push_setup &&
212
213
parent_orig=$(cd parent && git rev-parse --verify master) &&
213
214
(
214
- cd child &&
215
- test_must_fail git send-pack ../parent \
216
- refs/heads/master:refs/heads/master
215
+ cd child &&
216
+ test_must_fail git send-pack ../parent \
217
+ refs/heads/master:refs/heads/master
217
218
) &&
218
219
parent_head=$(cd parent && git rev-parse --verify master) &&
219
220
test "$parent_orig" = "$parent_head" &&
220
221
(
221
- cd child &&
222
- git send-pack ../parent \
223
- +refs/heads/master:refs/heads/master
222
+ cd child &&
223
+ git send-pack ../parent \
224
+ +refs/heads/master:refs/heads/master
224
225
) &&
225
226
parent_head=$(cd parent && git rev-parse --verify master) &&
226
227
child_head=$(cd child && git rev-parse --verify master) &&
@@ -231,16 +232,16 @@ test_expect_success 'pushing wildcard refspecs respects forcing' '
231
232
rewound_push_setup &&
232
233
parent_orig=$(cd parent && git rev-parse --verify master) &&
233
234
(
234
- cd child &&
235
- test_must_fail git send-pack ../parent \
236
- "refs/heads/*:refs/heads/*"
235
+ cd child &&
236
+ test_must_fail git send-pack ../parent \
237
+ "refs/heads/*:refs/heads/*"
237
238
) &&
238
239
parent_head=$(cd parent && git rev-parse --verify master) &&
239
240
test "$parent_orig" = "$parent_head" &&
240
241
(
241
- cd child &&
242
- git send-pack ../parent \
243
- "+refs/heads/*:refs/heads/*"
242
+ cd child &&
243
+ git send-pack ../parent \
244
+ "+refs/heads/*:refs/heads/*"
244
245
) &&
245
246
parent_head=$(cd parent && git rev-parse --verify master) &&
246
247
child_head=$(cd child && git rev-parse --verify master) &&
@@ -250,8 +251,8 @@ test_expect_success 'pushing wildcard refspecs respects forcing' '
250
251
test_expect_success ' deny pushing to delete current branch' '
251
252
rewound_push_setup &&
252
253
(
253
- cd child &&
254
- test_must_fail git send-pack ../parent :refs/heads/master 2>errs
254
+ cd child &&
255
+ test_must_fail git send-pack ../parent :refs/heads/master 2>errs
255
256
)
256
257
'
257
258
@@ -289,7 +290,7 @@ test_expect_success 'receive-pack de-dupes .have lines' '
289
290
EOF
290
291
291
292
GIT_TRACE_PACKET=$(pwd)/trace GIT_TEST_PROTOCOL_VERSION=0 \
292
- git push \
293
+ git push \
293
294
--receive-pack="unset GIT_TRACE_PACKET; git-receive-pack" \
294
295
fork HEAD:foo &&
295
296
extract_ref_advertisement <trace >refs &&
0 commit comments