@@ -311,8 +311,8 @@ test_expect_success 'init prefers command line to GIT_DIR' '
311
311
test_expect_success ' init with separate gitdir' '
312
312
rm -rf newdir &&
313
313
git init --separate-git-dir realgitdir newdir &&
314
- echo "gitdir: $(pwd)/realgitdir" >expected &&
315
- test_cmp expected newdir/.git &&
314
+ newdir_git="$(cat newdir/.git)" &&
315
+ test_cmp_fspath "$(pwd)/realgitdir" "${newdir_git#gitdir: }" &&
316
316
test_path_is_dir realgitdir/refs
317
317
'
318
318
@@ -361,25 +361,19 @@ test_expect_success 're-init on .git file' '
361
361
'
362
362
363
363
test_expect_success ' re-init to update git link' '
364
- (
365
- cd newdir &&
366
- git init --separate-git-dir ../surrealgitdir
367
- ) &&
368
- echo "gitdir: $(pwd)/surrealgitdir" >expected &&
369
- test_cmp expected newdir/.git &&
364
+ git -C newdir init --separate-git-dir ../surrealgitdir &&
365
+ newdir_git="$(cat newdir/.git)" &&
366
+ test_cmp_fspath "$(pwd)/surrealgitdir" "${newdir_git#gitdir: }" &&
370
367
test_path_is_dir surrealgitdir/refs &&
371
368
test_path_is_missing realgitdir/refs
372
369
'
373
370
374
371
test_expect_success ' re-init to move gitdir' '
375
372
rm -rf newdir realgitdir surrealgitdir &&
376
373
git init newdir &&
377
- (
378
- cd newdir &&
379
- git init --separate-git-dir ../realgitdir
380
- ) &&
381
- echo "gitdir: $(pwd)/realgitdir" >expected &&
382
- test_cmp expected newdir/.git &&
374
+ git -C newdir init --separate-git-dir ../realgitdir &&
375
+ newdir_git="$(cat newdir/.git)" &&
376
+ test_cmp_fspath "$(pwd)/realgitdir" "${newdir_git#gitdir: }" &&
383
377
test_path_is_dir realgitdir/refs
384
378
'
385
379
0 commit comments