@@ -48,12 +48,11 @@ test_expect_success 'fast-export | fast-import' '
48
48
mkdir new &&
49
49
git --git-dir=new/.git init &&
50
50
git fast-export --all >actual &&
51
- (cd new &&
52
- git fast-import &&
53
- test $MAIN = $(git rev-parse --verify refs/heads/main) &&
54
- test $REIN = $(git rev-parse --verify refs/tags/rein) &&
55
- test $WER = $(git rev-parse --verify refs/heads/wer) &&
56
- test $MUSS = $(git rev-parse --verify refs/tags/muss)) <actual
51
+ git -C new fast-import <actual &&
52
+ test $MAIN = $(git -C new rev-parse --verify refs/heads/main) &&
53
+ test $REIN = $(git -C new rev-parse --verify refs/tags/rein) &&
54
+ test $WER = $(git -C new rev-parse --verify refs/heads/wer) &&
55
+ test $MUSS = $(git -C new rev-parse --verify refs/tags/muss)
57
56
58
57
'
59
58
@@ -87,13 +86,11 @@ test_expect_success 'fast-export --mark-tags ^muss^{commit} muss' '
87
86
test_expect_success ' fast-export main~2..main' '
88
87
89
88
git fast-export main~2..main >actual &&
90
- sed "s/main/partial/" actual |
91
- (cd new &&
92
- git fast-import &&
93
- test $MAIN != $(git rev-parse --verify refs/heads/partial) &&
94
- git diff --exit-code main partial &&
95
- git diff --exit-code main^ partial^ &&
96
- test_must_fail git rev-parse partial~2)
89
+ sed "s/main/partial/" actual | git -C new fast-import &&
90
+ test $MAIN != $(git -C new rev-parse --verify refs/heads/partial) &&
91
+ git -C new diff --exit-code main partial &&
92
+ git -C new diff --exit-code main^ partial^ &&
93
+ test_must_fail git -C new rev-parse partial~2
97
94
98
95
'
99
96
@@ -102,10 +99,8 @@ test_expect_success 'fast-export --reference-excluded-parents main~2..main' '
102
99
git fast-export --reference-excluded-parents main~2..main >actual &&
103
100
grep commit.refs/heads/main actual >commit-count &&
104
101
test_line_count = 2 commit-count &&
105
- sed "s/main/rewrite/" actual |
106
- (cd new &&
107
- git fast-import &&
108
- test $MAIN = $(git rev-parse --verify refs/heads/rewrite))
102
+ sed "s/main/rewrite/" actual | git -C new fast-import &&
103
+ test $MAIN = $(git -C new rev-parse --verify refs/heads/rewrite)
109
104
'
110
105
111
106
test_expect_success ' fast-export --show-original-ids' '
@@ -133,20 +128,19 @@ test_expect_success ICONV 'reencoding iso-8859-7' '
133
128
echo rosten >file &&
134
129
git commit -s -F "$TEST_DIRECTORY/t9350/simple-iso-8859-7-commit-message.txt" file &&
135
130
git fast-export --reencode=yes wer^..wer >iso-8859-7.fi &&
136
- sed "s/wer/i18n/" iso-8859-7.fi |
137
- (cd new &&
138
- git fast-import &&
139
- # The commit object, if not re-encoded, would be 200 bytes plus hash.
140
- # Removing the "encoding iso-8859-7\n" header drops 20 bytes.
141
- # Re-encoding the Pi character from \xF0 (\360) in iso-8859-7
142
- # to \xCF\x80 (\317\200) in UTF-8 adds a byte. Check for
143
- # the expected size.
144
- test $(($(test_oid hexsz) + 181)) -eq "$(git cat-file -s i18n)" &&
145
- # ...and for the expected translation of bytes.
146
- git cat-file commit i18n >actual &&
147
- grep $(printf "\317\200") actual &&
148
- # Also make sure the commit does not have the "encoding" header
149
- ! grep ^encoding actual)
131
+ sed "s/wer/i18n/" iso-8859-7.fi | git -C new fast-import &&
132
+
133
+ # The commit object, if not re-encoded, would be 200 bytes plus hash.
134
+ # Removing the "encoding iso-8859-7\n" header drops 20 bytes.
135
+ # Re-encoding the Pi character from \xF0 (\360) in iso-8859-7
136
+ # to \xCF\x80 (\317\200) in UTF-8 adds a byte. Check for
137
+ # the expected size.
138
+ test $(($(test_oid hexsz) + 181)) -eq "$(git -C new cat-file -s i18n)" &&
139
+ # ...and for the expected translation of bytes.
140
+ git -C new cat-file commit i18n >actual &&
141
+ grep $(printf "\317\200") actual &&
142
+ # Also make sure the commit does not have the "encoding" header
143
+ ! grep ^encoding actual
150
144
'
151
145
152
146
test_expect_success ' aborting on iso-8859-7' '
@@ -165,20 +159,19 @@ test_expect_success 'preserving iso-8859-7' '
165
159
echo rosten >file &&
166
160
git commit -s -F "$TEST_DIRECTORY/t9350/simple-iso-8859-7-commit-message.txt" file &&
167
161
git fast-export --reencode=no wer^..wer >iso-8859-7.fi &&
168
- sed "s/wer/i18n-no-recoding/" iso-8859-7.fi |
169
- (cd new &&
170
- git fast-import &&
171
- # The commit object, if not re-encoded, is 200 bytes plus hash.
172
- # Removing the "encoding iso-8859-7\n" header would drops 20
173
- # bytes. Re-encoding the Pi character from \xF0 (\360) in
174
- # iso-8859-7 to \xCF\x80 (\317\200) in UTF-8 adds a byte.
175
- # Check for the expected size...
176
- test $(($(test_oid hexsz) + 200)) -eq "$(git cat-file -s i18n-no-recoding)" &&
177
- # ...as well as the expected byte.
178
- git cat-file commit i18n-no-recoding >actual &&
179
- grep $(printf "\360") actual &&
180
- # Also make sure the commit has the "encoding" header
181
- grep ^encoding actual)
162
+ sed "s/wer/i18n-no-recoding/" iso-8859-7.fi | git -C new fast-import &&
163
+
164
+ # The commit object, if not re-encoded, is 200 bytes plus hash.
165
+ # Removing the "encoding iso-8859-7\n" header would drops 20
166
+ # bytes. Re-encoding the Pi character from \xF0 (\360) in
167
+ # iso-8859-7 to \xCF\x80 (\317\200) in UTF-8 adds a byte.
168
+ # Check for the expected size...
169
+ test $(($(test_oid hexsz) + 200)) -eq "$(git -C new cat-file -s i18n-no-recoding)" &&
170
+ # ...as well as the expected byte.
171
+ git -C new cat-file commit i18n-no-recoding >actual &&
172
+ grep $(printf "\360") actual &&
173
+ # Also make sure the commit has the "encoding" header
174
+ grep ^encoding actual
182
175
'
183
176
184
177
test_expect_success ' encoding preserved if reencoding fails' '
@@ -188,18 +181,17 @@ test_expect_success 'encoding preserved if reencoding fails' '
188
181
echo rosten >file &&
189
182
git commit -s -F "$TEST_DIRECTORY/t9350/broken-iso-8859-7-commit-message.txt" file &&
190
183
git fast-export --reencode=yes wer^..wer >iso-8859-7.fi &&
191
- sed "s/wer/i18n-invalid/" iso-8859-7.fi |
192
- (cd new &&
193
- git fast-import &&
194
- git cat-file commit i18n-invalid >actual &&
195
- # Make sure the commit still has the encoding header
196
- grep ^encoding actual &&
197
- # Verify that the commit has the expected size; i.e.
198
- # that no bytes were re-encoded to a different encoding.
199
- test $(($(test_oid hexsz) + 212)) -eq "$(git cat-file -s i18n-invalid)" &&
200
- # ...and check for the original special bytes
201
- grep $(printf "\360") actual &&
202
- grep $(printf "\377") actual)
184
+ sed "s/wer/i18n-invalid/" iso-8859-7.fi | git -C new fast-import &&
185
+ git -C new cat-file commit i18n-invalid >actual &&
186
+
187
+ # Make sure the commit still has the encoding header
188
+ grep ^encoding actual &&
189
+ # Verify that the commit has the expected size; i.e.
190
+ # that no bytes were re-encoded to a different encoding.
191
+ test $(($(test_oid hexsz) + 212)) -eq "$(git -C new cat-file -s i18n-invalid)" &&
192
+ # ...and check for the original special bytes
193
+ grep $(printf "\360") actual &&
194
+ grep $(printf "\377") actual
203
195
'
204
196
205
197
test_expect_success ' import/export-marks' '
@@ -316,12 +308,9 @@ test_expect_success GPG 'signed-commits=verbatim' '
316
308
git fast-export --signed-commits=verbatim --reencode=no commit-signing >output &&
317
309
test_grep -E "^gpgsig $GIT_DEFAULT_HASH openpgp" output &&
318
310
grep "encoding ISO-8859-1" output &&
319
- (
320
- cd new &&
321
- git fast-import &&
322
- STRIPPED=$(git rev-parse --verify refs/heads/commit-signing) &&
323
- test $COMMIT_SIGNING = $STRIPPED
324
- ) <output
311
+ git -C new fast-import <output &&
312
+ STRIPPED=$(git -C new rev-parse --verify refs/heads/commit-signing) &&
313
+ test $COMMIT_SIGNING = $STRIPPED
325
314
326
315
'
327
316
@@ -331,12 +320,9 @@ test_expect_success GPG 'signed-commits=warn-verbatim' '
331
320
test_grep -E "^gpgsig $GIT_DEFAULT_HASH openpgp" output &&
332
321
grep "encoding ISO-8859-1" output &&
333
322
test -s err &&
334
- (
335
- cd new &&
336
- git fast-import &&
337
- STRIPPED=$(git rev-parse --verify refs/heads/commit-signing) &&
338
- test $COMMIT_SIGNING = $STRIPPED
339
- ) <output
323
+ git -C new fast-import <output &&
324
+ STRIPPED=$(git -C new rev-parse --verify refs/heads/commit-signing) &&
325
+ test $COMMIT_SIGNING = $STRIPPED
340
326
341
327
'
342
328
@@ -345,12 +331,9 @@ test_expect_success GPG 'signed-commits=strip' '
345
331
git fast-export --signed-commits=strip --reencode=no commit-signing >output &&
346
332
! grep ^gpgsig output &&
347
333
grep "^encoding ISO-8859-1" output &&
348
- sed "s/commit-signing/commit-strip-signing/" output | (
349
- cd new &&
350
- git fast-import &&
351
- STRIPPED=$(git rev-parse --verify refs/heads/commit-strip-signing) &&
352
- test $COMMIT_SIGNING != $STRIPPED
353
- )
334
+ sed "s/commit-signing/commit-strip-signing/" output | git -C new fast-import &&
335
+ STRIPPED=$(git -C new rev-parse --verify refs/heads/commit-strip-signing) &&
336
+ test $COMMIT_SIGNING != $STRIPPED
354
337
355
338
'
356
339
@@ -360,12 +343,9 @@ test_expect_success GPG 'signed-commits=warn-strip' '
360
343
! grep ^gpgsig output &&
361
344
grep "^encoding ISO-8859-1" output &&
362
345
test -s err &&
363
- sed "s/commit-signing/commit-strip-signing/" output | (
364
- cd new &&
365
- git fast-import &&
366
- STRIPPED=$(git rev-parse --verify refs/heads/commit-strip-signing) &&
367
- test $COMMIT_SIGNING != $STRIPPED
368
- )
346
+ sed "s/commit-signing/commit-strip-signing/" output | git -C new fast-import &&
347
+ STRIPPED=$(git -C new rev-parse --verify refs/heads/commit-strip-signing) &&
348
+ test $COMMIT_SIGNING != $STRIPPED
369
349
370
350
'
371
351
@@ -386,14 +366,11 @@ test_expect_success GPGSM 'round-trip X.509 signed commit' '
386
366
387
367
git fast-export --signed-commits=verbatim x509-signing >output &&
388
368
test_grep -E "^gpgsig $GIT_DEFAULT_HASH x509" output &&
389
- (
390
- cd new &&
391
- git fast-import &&
392
- git cat-file commit refs/heads/x509-signing >actual &&
393
- grep "^gpgsig" actual &&
394
- IMPORTED=$(git rev-parse refs/heads/x509-signing) &&
395
- test $X509_COMMIT = $IMPORTED
396
- ) <output
369
+ git -C new fast-import <output &&
370
+ git -C new cat-file commit refs/heads/x509-signing >actual &&
371
+ grep "^gpgsig" actual &&
372
+ IMPORTED=$(git -C new rev-parse refs/heads/x509-signing) &&
373
+ test $X509_COMMIT = $IMPORTED
397
374
398
375
'
399
376
@@ -414,14 +391,11 @@ test_expect_success GPGSSH 'round-trip SSH signed commit' '
414
391
415
392
git fast-export --signed-commits=verbatim ssh-signing >output &&
416
393
test_grep -E "^gpgsig $GIT_DEFAULT_HASH ssh" output &&
417
- (
418
- cd new &&
419
- git fast-import &&
420
- git cat-file commit refs/heads/ssh-signing >actual &&
421
- grep "^gpgsig" actual &&
422
- IMPORTED=$(git rev-parse refs/heads/ssh-signing) &&
423
- test $SSH_COMMIT = $IMPORTED
424
- ) <output
394
+ git -C new fast-import <output &&
395
+ git -C new cat-file commit refs/heads/ssh-signing >actual &&
396
+ grep "^gpgsig" actual &&
397
+ IMPORTED=$(git -C new rev-parse refs/heads/ssh-signing) &&
398
+ test $SSH_COMMIT = $IMPORTED
425
399
426
400
'
427
401
@@ -461,14 +435,13 @@ test_expect_success 'submodule fast-export | fast-import' '
461
435
mkdir new &&
462
436
git --git-dir=new/.git init &&
463
437
git fast-export --signed-tags=strip --all >actual &&
464
- (cd new &&
465
- git fast-import &&
466
- test "$SUBENT1" = "$(git ls-tree refs/heads/main^ sub)" &&
467
- test "$SUBENT2" = "$(git ls-tree refs/heads/main sub)" &&
468
- git checkout main &&
469
- git submodule init &&
470
- git submodule update &&
471
- cmp sub/file ../sub/file) <actual
438
+ git -C new fast-import <actual &&
439
+ test "$SUBENT1" = "$(git -C new ls-tree refs/heads/main^ sub)" &&
440
+ test "$SUBENT2" = "$(git -C new ls-tree refs/heads/main sub)" &&
441
+ git -C new checkout main &&
442
+ git -C new submodule init &&
443
+ git -C new submodule update &&
444
+ cmp new/sub/file sub/file
472
445
473
446
'
474
447
@@ -510,10 +483,8 @@ test_expect_success 'fast-export -C -C | fast-import' '
510
483
git --git-dir=new/.git init &&
511
484
git fast-export -C -C --signed-tags=strip --all > output &&
512
485
grep "^C file2 file4\$" output &&
513
- cat output |
514
- (cd new &&
515
- git fast-import &&
516
- test $ENTRY = $(git rev-parse --verify refs/heads/copy))
486
+ git -C new fast-import <output &&
487
+ test $ENTRY = $(git -C new rev-parse --verify refs/heads/copy)
517
488
518
489
'
519
490
@@ -986,21 +957,17 @@ test_expect_success GPG 'export and import of doubly signed commit' '
986
957
git -C explicit-sha256 fast-export --signed-commits=verbatim dual-signed >output &&
987
958
test_grep -E "^gpgsig sha1 openpgp" output &&
988
959
test_grep -E "^gpgsig sha256 openpgp" output &&
989
-
990
- (
991
- cd new &&
992
- git fast-import &&
993
- git cat-file commit refs/heads/dual-signed >actual &&
994
- test_grep -E "^gpgsig " actual &&
995
- test_grep -E "^gpgsig-sha256 " actual &&
996
- IMPORTED=$(git rev-parse refs/heads/dual-signed) &&
997
- if test "$GIT_DEFAULT_HASH" = "sha1"
998
- then
999
- test $SHA1_B = $IMPORTED
1000
- else
1001
- test $SHA256_B = $IMPORTED
1002
- fi
1003
- ) <output
960
+ git -C new fast-import <output &&
961
+ git -C new cat-file commit refs/heads/dual-signed >actual &&
962
+ test_grep -E "^gpgsig " actual &&
963
+ test_grep -E "^gpgsig-sha256 " actual &&
964
+ IMPORTED=$(git -C new rev-parse refs/heads/dual-signed) &&
965
+ if test "$GIT_DEFAULT_HASH" = "sha1"
966
+ then
967
+ test $SHA1_B = $IMPORTED
968
+ else
969
+ test $SHA256_B = $IMPORTED
970
+ fi
1004
971
'
1005
972
1006
973
test_done
0 commit comments