contrib/subtree: use tabs consitently for indentation in tests
Although subtrees tests uses more spaces for indentation than tabs, there are still quite a lot of lines indented with tabs. As tabs conform with Git coding guidelines resolve the inconsistency in favour of tabs. Signed-off-by: Charles Bailey <cbailey32@bloomberg.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Charles Bailey committed
Jun 22, 2015 at 14:53 UTC
41208825a8553f98295b8521a9ece7f3e81c2a75
1 file changed
+147
-147
contrib/subtree/t/t7900-subtree.sh
+147
-147
@@ -62,17 +62,17 @@ last_commit_message()
62
}
63
64
test_expect_success 'init subproj' '
65
- test_create_repo subproj
65
+ test_create_repo subproj
66
'
67
68
# To the subproject!
69
cd subproj
70
71
test_expect_success 'add sub1' '
72
- create sub1 &&
73
- git commit -m "sub1" &&
74
- git branch sub1 &&
75
- git branch -m master subproj
72
+ create sub1 &&
73
+ git commit -m "sub1" &&
74
+ git branch sub1 &&
75
+ git branch -m master subproj
76
'
77
78
# Save this hash for testing later.
@@ -80,133 +80,133 @@ test_expect_success 'add sub1' '
80
subdir_hash=$(git rev-parse HEAD)
81
82
test_expect_success 'add sub2' '
83
- create sub2 &&
84
- git commit -m "sub2" &&
85
- git branch sub2
83
+ create sub2 &&
84
+ git commit -m "sub2" &&
85
+ git branch sub2
86
'
87
88
test_expect_success 'add sub3' '
89
- create sub3 &&
90
- git commit -m "sub3" &&
91
- git branch sub3
89
+ create sub3 &&
90
+ git commit -m "sub3" &&
91
+ git branch sub3
92
'
93
94
# Back to mainline
95
cd ..
96
97
test_expect_success 'add main4' '
98
- create main4 &&
99
- git commit -m "main4" &&
100
- git branch -m master mainline &&
101
- git branch subdir
98
+ create main4 &&
99
+ git commit -m "main4" &&
100
+ git branch -m master mainline &&
101
+ git branch subdir
102
'
103
104
test_expect_success 'fetch subproj history' '
105
- git fetch ./subproj sub1 &&
106
- git branch sub1 FETCH_HEAD
105
+ git fetch ./subproj sub1 &&
106
+ git branch sub1 FETCH_HEAD
107
'
108
109
test_expect_success 'no subtree exists in main tree' '
110
- test_must_fail git subtree merge --prefix=subdir sub1
110
+ test_must_fail git subtree merge --prefix=subdir sub1
111
'
112
113
test_expect_success 'no pull from non-existant subtree' '
114
- test_must_fail git subtree pull --prefix=subdir ./subproj sub1
114
+ test_must_fail git subtree pull --prefix=subdir ./subproj sub1
115
'
116
117
test_expect_success 'check if --message works for add' '
118
- git subtree add --prefix=subdir --message="Added subproject" sub1 &&
119
- check_equal ''"$(last_commit_message)"'' "Added subproject" &&
120
- undo
118
+ git subtree add --prefix=subdir --message="Added subproject" sub1 &&
119
+ check_equal ''"$(last_commit_message)"'' "Added subproject" &&
120
+ undo
121
'
122
123
test_expect_success 'check if --message works as -m and --prefix as -P' '
124
- git subtree add -P subdir -m "Added subproject using git subtree" sub1 &&
125
- check_equal ''"$(last_commit_message)"'' "Added subproject using git subtree" &&
126
- undo
124
+ git subtree add -P subdir -m "Added subproject using git subtree" sub1 &&
125
+ check_equal ''"$(last_commit_message)"'' "Added subproject using git subtree" &&
126
+ undo
127
'
128
129
test_expect_success 'check if --message works with squash too' '
130
- git subtree add -P subdir -m "Added subproject with squash" --squash sub1 &&
131
- check_equal ''"$(last_commit_message)"'' "Added subproject with squash" &&
132
- undo
130
+ git subtree add -P subdir -m "Added subproject with squash" --squash sub1 &&
131
+ check_equal ''"$(last_commit_message)"'' "Added subproject with squash" &&
132
+ undo
133
'
134
135
test_expect_success 'add subproj to mainline' '
136
- git subtree add --prefix=subdir/ FETCH_HEAD &&
137
- check_equal ''"$(last_commit_message)"'' "Add '"'subdir/'"' from commit '"'"'''"$(git rev-parse sub1)"'''"'"'"
136
+ git subtree add --prefix=subdir/ FETCH_HEAD &&
137
+ check_equal ''"$(last_commit_message)"'' "Add '"'subdir/'"' from commit '"'"'''"$(git rev-parse sub1)"'''"'"'"
138
'
139
140
# this shouldn't actually do anything, since FETCH_HEAD is already a parent
141
test_expect_success 'merge fetched subproj' '
142
- git merge -m "merge -s -ours" -s ours FETCH_HEAD
142
+ git merge -m "merge -s -ours" -s ours FETCH_HEAD
143
'
144
145
test_expect_success 'add main-sub5' '
146
- create subdir/main-sub5 &&
147
- git commit -m "main-sub5"
146
+ create subdir/main-sub5 &&
147
+ git commit -m "main-sub5"
148
'
149
150
test_expect_success 'add main6' '
151
- create main6 &&
152
- git commit -m "main6 boring"
151
+ create main6 &&
152
+ git commit -m "main6 boring"
153
'
154
155
test_expect_success 'add main-sub7' '
156
- create subdir/main-sub7 &&
157
- git commit -m "main-sub7"
156
+ create subdir/main-sub7 &&
157
+ git commit -m "main-sub7"
158
'
159
160
test_expect_success 'fetch new subproj history' '
161
- git fetch ./subproj sub2 &&
162
- git branch sub2 FETCH_HEAD
161
+ git fetch ./subproj sub2 &&
162
+ git branch sub2 FETCH_HEAD
163
'
164
165
test_expect_success 'check if --message works for merge' '
166
- git subtree merge --prefix=subdir -m "Merged changes from subproject" sub2 &&
167
- check_equal ''"$(last_commit_message)"'' "Merged changes from subproject" &&
168
- undo
166
+ git subtree merge --prefix=subdir -m "Merged changes from subproject" sub2 &&
167
+ check_equal ''"$(last_commit_message)"'' "Merged changes from subproject" &&
168
+ undo
169
'
170
171
test_expect_success 'check if --message for merge works with squash too' '
172
- git subtree merge --prefix subdir -m "Merged changes from subproject using squash" --squash sub2 &&
173
- check_equal ''"$(last_commit_message)"'' "Merged changes from subproject using squash" &&
174
- undo
172
+ git subtree merge --prefix subdir -m "Merged changes from subproject using squash" --squash sub2 &&
173
+ check_equal ''"$(last_commit_message)"'' "Merged changes from subproject using squash" &&
174
+ undo
175
'
176
177
test_expect_success 'merge new subproj history into subdir' '
178
- git subtree merge --prefix=subdir FETCH_HEAD &&
179
- git branch pre-split &&
180
- check_equal ''"$(last_commit_message)"'' "Merge commit '"'"'"$(git rev-parse sub2)"'"'"' into mainline"
178
+ git subtree merge --prefix=subdir FETCH_HEAD &&
179
+ git branch pre-split &&
180
+ check_equal ''"$(last_commit_message)"'' "Merge commit '"'"'"$(git rev-parse sub2)"'"'"' into mainline"
181
'
182
183
test_expect_success 'Check that prefix argument is required for split' '
184
- echo "You must provide the --prefix option." > expected &&
185
- test_must_fail git subtree split > actual 2>&1 &&
184
+ echo "You must provide the --prefix option." > expected &&
185
+ test_must_fail git subtree split > actual 2>&1 &&
186
test_debug "printf '"'"'expected: '"'"'" &&
187
- test_debug "cat expected" &&
187
+ test_debug "cat expected" &&
188
test_debug "printf '"'"'actual: '"'"'" &&
189
- test_debug "cat actual" &&
190
- test_cmp expected actual &&
191
- rm -f expected actual
189
+ test_debug "cat actual" &&
190
+ test_cmp expected actual &&
191
+ rm -f expected actual
192
'
193
194
test_expect_success 'Check that the <prefix> exists for a split' '
195
- echo "'"'"'non-existent-directory'"'"'" does not exist\; use "'"'"'git subtree add'"'"'" > expected &&
196
- test_must_fail git subtree split --prefix=non-existent-directory > actual 2>&1 &&
195
+ echo "'"'"'non-existent-directory'"'"'" does not exist\; use "'"'"'git subtree add'"'"'" > expected &&
196
+ test_must_fail git subtree split --prefix=non-existent-directory > actual 2>&1 &&
197
test_debug "printf '"'"'expected: '"'"'" &&
198
- test_debug "cat expected" &&
198
+ test_debug "cat expected" &&
199
test_debug "printf '"'"'actual: '"'"'" &&
200
- test_debug "cat actual" &&
201
- test_cmp expected actual
202
-# rm -f expected actual
200
+ test_debug "cat actual" &&
201
+ test_cmp expected actual
202
+# rm -f expected actual
203
'
204
205
test_expect_success 'check if --message works for split+rejoin' '
206
- spl1=''"$(git subtree split --annotate='"'*'"' --prefix subdir --onto FETCH_HEAD --message "Split & rejoin" --rejoin)"'' &&
207
- git branch spl1 "$spl1" &&
208
- check_equal ''"$(last_commit_message)"'' "Split & rejoin" &&
209
- undo
206
+ spl1=''"$(git subtree split --annotate='"'*'"' --prefix subdir --onto FETCH_HEAD --message "Split & rejoin" --rejoin)"'' &&
207
+ git branch spl1 "$spl1" &&
208
+ check_equal ''"$(last_commit_message)"'' "Split & rejoin" &&
209
+ undo
210
'
211
212
test_expect_success 'check split with --branch' '
@@ -228,69 +228,69 @@ test_expect_success 'check hash of split' '
228
'
229
230
test_expect_success 'check split with --branch for an existing branch' '
231
- spl1=''"$(git subtree split --annotate='"'*'"' --prefix subdir --onto FETCH_HEAD --message "Split & rejoin" --rejoin)"'' &&
232
- undo &&
233
- git branch splitbr2 sub1 &&
234
- git subtree split --annotate='"'*'"' --prefix subdir --onto FETCH_HEAD --branch splitbr2 &&
235
- check_equal ''"$(git rev-parse splitbr2)"'' "$spl1"
231
+ spl1=''"$(git subtree split --annotate='"'*'"' --prefix subdir --onto FETCH_HEAD --message "Split & rejoin" --rejoin)"'' &&
232
+ undo &&
233
+ git branch splitbr2 sub1 &&
234
+ git subtree split --annotate='"'*'"' --prefix subdir --onto FETCH_HEAD --branch splitbr2 &&
235
+ check_equal ''"$(git rev-parse splitbr2)"'' "$spl1"
236
'
237
238
test_expect_success 'check split with --branch for an incompatible branch' '
239
- test_must_fail git subtree split --prefix subdir --onto FETCH_HEAD --branch subdir
239
+ test_must_fail git subtree split --prefix subdir --onto FETCH_HEAD --branch subdir
240
'
241
242
test_expect_success 'check split+rejoin' '
243
- spl1=''"$(git subtree split --annotate='"'*'"' --prefix subdir --onto FETCH_HEAD --message "Split & rejoin" --rejoin)"'' &&
244
- undo &&
245
- git subtree split --annotate='"'*'"' --prefix subdir --onto FETCH_HEAD --rejoin &&
246
- check_equal ''"$(last_commit_message)"'' "Split '"'"'subdir/'"'"' into commit '"'"'"$spl1"'"'"'"
243
+ spl1=''"$(git subtree split --annotate='"'*'"' --prefix subdir --onto FETCH_HEAD --message "Split & rejoin" --rejoin)"'' &&
244
+ undo &&
245
+ git subtree split --annotate='"'*'"' --prefix subdir --onto FETCH_HEAD --rejoin &&
246
+ check_equal ''"$(last_commit_message)"'' "Split '"'"'subdir/'"'"' into commit '"'"'"$spl1"'"'"'"
247
'
248
249
test_expect_success 'add main-sub8' '
250
- create subdir/main-sub8 &&
251
- git commit -m "main-sub8"
250
+ create subdir/main-sub8 &&
251
+ git commit -m "main-sub8"
252
'
253
254
# To the subproject!
255
cd ./subproj
256
257
test_expect_success 'merge split into subproj' '
258
- git fetch .. spl1 &&
259
- git branch spl1 FETCH_HEAD &&
260
- git merge FETCH_HEAD
258
+ git fetch .. spl1 &&
259
+ git branch spl1 FETCH_HEAD &&
260
+ git merge FETCH_HEAD
261
'
262
263
test_expect_success 'add sub9' '
264
- create sub9 &&
265
- git commit -m "sub9"
264
+ create sub9 &&
265
+ git commit -m "sub9"
266
'
267
268
# Back to mainline
269
cd ..
270
271
test_expect_success 'split for sub8' '
272
- split2=''"$(git subtree split --annotate='"'*'"' --prefix subdir/ --rejoin)"''
273
- git branch split2 "$split2"
272
+ split2=''"$(git subtree split --annotate='"'*'"' --prefix subdir/ --rejoin)"''
273
+ git branch split2 "$split2"
274
'
275
276
test_expect_success 'add main-sub10' '
277
- create subdir/main-sub10 &&
278
- git commit -m "main-sub10"
277
+ create subdir/main-sub10 &&
278
+ git commit -m "main-sub10"
279
'
280
281
test_expect_success 'split for sub10' '
282
- spl3=''"$(git subtree split --annotate='"'*'"' --prefix subdir --rejoin)"'' &&
283
- git branch spl3 "$spl3"
282
+ spl3=''"$(git subtree split --annotate='"'*'"' --prefix subdir --rejoin)"'' &&
283
+ git branch spl3 "$spl3"
284
'
285
286
# To the subproject!
287
cd ./subproj
288
289
test_expect_success 'merge split into subproj' '
290
- git fetch .. spl3 &&
291
- git branch spl3 FETCH_HEAD &&
292
- git merge FETCH_HEAD &&
293
- git branch subproj-merge-spl3
290
+ git fetch .. spl3 &&
291
+ git branch spl3 FETCH_HEAD &&
292
+ git merge FETCH_HEAD &&
293
+ git branch subproj-merge-spl3
294
'
295
296
chkm="main4 main6"
@@ -300,44 +300,44 @@ chks="sub1 sub2 sub3 sub9"
300
chks_sub=$(echo $chks | multiline | sed 's,^,subdir/,' | fixnl)
301
302
test_expect_success 'make sure exactly the right set of files ends up in the subproj' '
303
- subfiles=''"$(git ls-files | fixnl)"'' &&
304
- check_equal "$subfiles" "$chkms $chks"
303
+ subfiles=''"$(git ls-files | fixnl)"'' &&
304
+ check_equal "$subfiles" "$chkms $chks"
305
'
306
307
test_expect_success 'make sure the subproj history *only* contains commits that affect the subdir' '
308
- allchanges=''"$(git log --name-only --pretty=format:'"''"' | sort | fixnl)"'' &&
309
- check_equal "$allchanges" "$chkms $chks"
308
+ allchanges=''"$(git log --name-only --pretty=format:'"''"' | sort | fixnl)"'' &&
309
+ check_equal "$allchanges" "$chkms $chks"
310
'
311
312
# Back to mainline
313
cd ..
314
315
test_expect_success 'pull from subproj' '
316
- git fetch ./subproj subproj-merge-spl3 &&
317
- git branch subproj-merge-spl3 FETCH_HEAD &&
318
- git subtree pull --prefix=subdir ./subproj subproj-merge-spl3
316
+ git fetch ./subproj subproj-merge-spl3 &&
317
+ git branch subproj-merge-spl3 FETCH_HEAD &&
318
+ git subtree pull --prefix=subdir ./subproj subproj-merge-spl3
319
'
320
321
test_expect_success 'make sure exactly the right set of files ends up in the mainline' '
322
- mainfiles=''"$(git ls-files | fixnl)"'' &&
323
- check_equal "$mainfiles" "$chkm $chkms_sub $chks_sub"
322
+ mainfiles=''"$(git ls-files | fixnl)"'' &&
323
+ check_equal "$mainfiles" "$chkm $chkms_sub $chks_sub"
324
'
325
326
test_expect_success 'make sure each filename changed exactly once in the entire history' '
327
- # main-sub?? and /subdir/main-sub?? both change, because those are the
328
- # changes that were split into their own history. And subdir/sub?? never
329
- # change, since they were *only* changed in the subtree branch.
330
- allchanges=''"$(git log --name-only --pretty=format:'"''"' | sort | fixnl)"'' &&
331
- check_equal "$allchanges" ''"$(echo $chkms $chkm $chks $chkms_sub | multiline | sort | fixnl)"''
327
+ # main-sub?? and /subdir/main-sub?? both change, because those are the
328
+ # changes that were split into their own history. And subdir/sub?? never
329
+ # change, since they were *only* changed in the subtree branch.
330
+ allchanges=''"$(git log --name-only --pretty=format:'"''"' | sort | fixnl)"'' &&
331
+ check_equal "$allchanges" ''"$(echo $chkms $chkm $chks $chkms_sub | multiline | sort | fixnl)"''
332
'
333
334
test_expect_success 'make sure the --rejoin commits never make it into subproj' '
335
- check_equal ''"$(git log --pretty=format:'"'%s'"' HEAD^2 | grep -i split)"'' ""
335
+ check_equal ''"$(git log --pretty=format:'"'%s'"' HEAD^2 | grep -i split)"'' ""
336
'
337
338
test_expect_success 'make sure no "git subtree" tagged commits make it into subproj' '
339
- # They are meaningless to subproj since one side of the merge refers to the mainline
340
- check_equal ''"$(git log --pretty=format:'"'%s%n%b'"' HEAD^2 | grep "git-subtree.*:")"'' ""
339
+ # They are meaningless to subproj since one side of the merge refers to the mainline
340
+ check_equal ''"$(git log --pretty=format:'"'%s%n%b'"' HEAD^2 | grep "git-subtree.*:")"'' ""
341
'
342
343
# prepare second pair of repositories
@@ -345,27 +345,27 @@ mkdir test2
345
cd test2
346
347
test_expect_success 'init main' '
348
- test_create_repo main
348
+ test_create_repo main
349
'
350
351
cd main
352
353
test_expect_success 'add main1' '
354
- create main1 &&
355
- git commit -m "main1"
354
+ create main1 &&
355
+ git commit -m "main1"
356
'
357
358
cd ..
359
360
test_expect_success 'init sub' '
361
- test_create_repo sub
361
+ test_create_repo sub
362
'
363
364
cd sub
365
366
test_expect_success 'add sub2' '
367
- create sub2 &&
368
- git commit -m "sub2"
367
+ create sub2 &&
368
+ git commit -m "sub2"
369
'
370
371
cd ../main
@@ -373,33 +373,33 @@ cd ../main
373
# check if split can find proper base without --onto
374
375
test_expect_success 'add sub as subdir in main' '
376
- git fetch ../sub master &&
377
- git branch sub2 FETCH_HEAD &&
378
- git subtree add --prefix subdir sub2
376
+ git fetch ../sub master &&
377
+ git branch sub2 FETCH_HEAD &&
378
+ git subtree add --prefix subdir sub2
379
'
380
381
cd ../sub
382
383
test_expect_success 'add sub3' '
384
- create sub3 &&
385
- git commit -m "sub3"
384
+ create sub3 &&
385
+ git commit -m "sub3"
386
'
387
388
cd ../main
389
390
test_expect_success 'merge from sub' '
391
- git fetch ../sub master &&
392
- git branch sub3 FETCH_HEAD &&
393
- git subtree merge --prefix subdir sub3
391
+ git fetch ../sub master &&
392
+ git branch sub3 FETCH_HEAD &&
393
+ git subtree merge --prefix subdir sub3
394
'
395
396
test_expect_success 'add main-sub4' '
397
- create subdir/main-sub4 &&
398
- git commit -m "main-sub4"
397
+ create subdir/main-sub4 &&
398
+ git commit -m "main-sub4"
399
'
400
401
test_expect_success 'split for main-sub4 without --onto' '
402
- git subtree split --prefix subdir --branch mainsub4
402
+ git subtree split --prefix subdir --branch mainsub4
403
'
404
405
# at this point, the new commit parent should be sub3 if it is not,
@@ -408,21 +408,21 @@ test_expect_success 'split for main-sub4 without --onto' '
408
# itself)
409
410
test_expect_success 'check that the commit parent is sub3' '
411
- check_equal ''"$(git log --pretty=format:%P -1 mainsub4)"'' ''"$(git rev-parse sub3)"''
411
+ check_equal ''"$(git log --pretty=format:%P -1 mainsub4)"'' ''"$(git rev-parse sub3)"''
412
'
413
414
test_expect_success 'add main-sub5' '
415
- mkdir subdir2 &&
416
- create subdir2/main-sub5 &&
417
- git commit -m "main-sub5"
415
+ mkdir subdir2 &&
416
+ create subdir2/main-sub5 &&
417
+ git commit -m "main-sub5"
418
'
419
420
test_expect_success 'split for main-sub5 without --onto' '
421
- # also test that we still can split out an entirely new subtree
422
- # if the parent of the first commit in the tree is not empty,
421
+ # also test that we still can split out an entirely new subtree
422
+ # if the parent of the first commit in the tree is not empty,
423
# then the new subtree has accidentally been attached to something
424
- git subtree split --prefix subdir2 --branch mainsub5 &&
425
- check_equal ''"$(git log --pretty=format:%P -1 mainsub5)"'' ""
424
+ git subtree split --prefix subdir2 --branch mainsub5 &&
425
+ check_equal ''"$(git log --pretty=format:%P -1 mainsub5)"'' ""
426
'
427
428
# make sure no patch changes more than one file. The original set of commits
@@ -450,20 +450,20 @@ joincommits()
450
}
451
452
test_expect_success 'verify one file change per commit' '
453
- x= &&
454
- list=''"$(git log --pretty=format:'"'commit: %H'"' | joincommits)"'' &&
455
-# test_debug "echo HERE" &&
456
-# test_debug "echo ''"$list"''" &&
457
- (git log --pretty=format:'"'commit: %H'"' | joincommits |
458
- ( while read commit a b; do
459
- test_debug "echo Verifying commit "''"$commit"''
460
- test_debug "echo a: "''"$a"''
461
- test_debug "echo b: "''"$b"''
462
- check_equal "$b" ""
463
- x=1
464
- done
465
- check_equal "$x" 1
466
- ))
453
+ x= &&
454
+ list=''"$(git log --pretty=format:'"'commit: %H'"' | joincommits)"'' &&
455
+# test_debug "echo HERE" &&
456
+# test_debug "echo ''"$list"''" &&
457
+ (git log --pretty=format:'"'commit: %H'"' | joincommits |
458
+ ( while read commit a b; do
459
+ test_debug "echo Verifying commit "''"$commit"''
460
+ test_debug "echo a: "''"$a"''
461
+ test_debug "echo b: "''"$b"''
462
+ check_equal "$b" ""
463
+ x=1
464
+ done
465
+ check_equal "$x" 1
466
+ ))
467
'
468
469
test_done