@@ -60,8 +60,8 @@ test_expect_success 'checking the commit' '
60
60
61
61
test_expect_success ' mv --dry-run does not move file' '
62
62
git mv -n path0/COPYING MOVED &&
63
- test -f path0/COPYING &&
64
- test ! -f MOVED
63
+ test_path_is_file path0/COPYING &&
64
+ test_path_is_missing MOVED
65
65
'
66
66
67
67
test_expect_success ' checking -k on non-existing file' '
@@ -71,25 +71,25 @@ test_expect_success 'checking -k on non-existing file' '
71
71
test_expect_success ' checking -k on untracked file' '
72
72
>untracked1 &&
73
73
git mv -k untracked1 path0 &&
74
- test -f untracked1 &&
75
- test ! -f path0/untracked1
74
+ test_path_is_file untracked1 &&
75
+ test_path_is_missing path0/untracked1
76
76
'
77
77
78
78
test_expect_success ' checking -k on multiple untracked files' '
79
79
>untracked2 &&
80
80
git mv -k untracked1 untracked2 path0 &&
81
- test -f untracked1 &&
82
- test -f untracked2 &&
83
- test ! -f path0/untracked1 &&
84
- test ! -f path0/untracked2
81
+ test_path_is_file untracked1 &&
82
+ test_path_is_file untracked2 &&
83
+ test_path_is_missing path0/untracked1 &&
84
+ test_path_is_missing path0/untracked2
85
85
'
86
86
87
87
test_expect_success ' checking -f on untracked file with existing target' '
88
88
>path0/untracked1 &&
89
89
test_must_fail git mv -f untracked1 path0 &&
90
- test ! -f .git/index.lock &&
91
- test -f untracked1 &&
92
- test -f path0/untracked1
90
+ test_path_is_missing .git/index.lock &&
91
+ test_path_is_file untracked1 &&
92
+ test_path_is_file path0/untracked1
93
93
'
94
94
95
95
# clean up the mess in case bad things happen
@@ -215,8 +215,8 @@ test_expect_success 'absolute pathname' '
215
215
git add sub/file &&
216
216
217
217
git mv sub "$(pwd)/in" &&
218
- ! test -d sub &&
219
- test -d in &&
218
+ test_path_is_missing sub &&
219
+ test_path_is_dir in &&
220
220
git ls-files --error-unmatch in/file
221
221
)
222
222
'
@@ -234,8 +234,8 @@ test_expect_success 'absolute pathname outside should fail' '
234
234
git add sub/file &&
235
235
236
236
test_must_fail git mv sub "$out/out" &&
237
- test -d sub &&
238
- ! test -d ../in &&
237
+ test_path_is_dir sub &&
238
+ test_path_is_missing ../in &&
239
239
git ls-files --error-unmatch sub/file
240
240
)
241
241
'
@@ -295,8 +295,8 @@ test_expect_success 'git mv should overwrite symlink to a file' '
295
295
git add moved &&
296
296
test_must_fail git mv moved symlink &&
297
297
git mv -f moved symlink &&
298
- ! test -e moved &&
299
- test -f symlink &&
298
+ test_path_is_missing moved &&
299
+ test_path_is_file symlink &&
300
300
test "$(cat symlink)" = 1 &&
301
301
git update-index --refresh &&
302
302
git diff-files --quiet
@@ -312,13 +312,13 @@ test_expect_success 'git mv should overwrite file with a symlink' '
312
312
git add moved &&
313
313
test_must_fail git mv symlink moved &&
314
314
git mv -f symlink moved &&
315
- ! test -e symlink &&
315
+ test_path_is_missing symlink &&
316
316
git update-index --refresh &&
317
317
git diff-files --quiet
318
318
'
319
319
320
320
test_expect_success SYMLINKS ' check moved symlink' '
321
- test -h moved
321
+ test_path_is_symlink moved
322
322
'
323
323
324
324
rm -f moved symlink
@@ -352,7 +352,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
352
352
) &&
353
353
mkdir mod &&
354
354
git mv sub mod/sub &&
355
- ! test -e sub &&
355
+ test_path_is_missing sub &&
356
356
test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
357
357
git -C mod/sub status &&
358
358
git update-index --refresh &&
@@ -372,7 +372,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
372
372
) &&
373
373
mkdir mod &&
374
374
git mv sub mod/sub &&
375
- ! test -e sub &&
375
+ test_path_is_missing sub &&
376
376
test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
377
377
git -C mod/sub status &&
378
378
echo mod/sub >expected &&
@@ -389,7 +389,7 @@ test_expect_success 'git mv moves a submodule with gitfile' '
389
389
entry="$(git ls-files --stage sub | cut -f 1)" &&
390
390
mkdir mod &&
391
391
git -C mod mv ../sub/ . &&
392
- ! test -e sub &&
392
+ test_path_is_missing sub &&
393
393
test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
394
394
git -C mod/sub status &&
395
395
echo mod/sub >expected &&
@@ -408,7 +408,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
408
408
mkdir mod &&
409
409
git mv sub mod/sub 2>actual.err &&
410
410
test_must_be_empty actual.err &&
411
- ! test -e sub &&
411
+ test_path_is_missing sub &&
412
412
test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
413
413
git -C mod/sub status &&
414
414
git update-index --refresh &&
@@ -423,13 +423,13 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
423
423
entry="$(git ls-files --stage sub | cut -f 1)" &&
424
424
mkdir mod &&
425
425
test_must_fail git mv sub mod/sub 2>actual.err &&
426
- test -s actual.err &&
427
- test -e sub &&
426
+ test_file_not_empty actual.err &&
427
+ test_path_exists sub &&
428
428
git diff-files --quiet -- sub &&
429
429
git add .gitmodules &&
430
430
git mv sub mod/sub 2>actual.err &&
431
431
test_must_be_empty actual.err &&
432
- ! test -e sub &&
432
+ test_path_is_missing sub &&
433
433
test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
434
434
git -C mod/sub status &&
435
435
git update-index --refresh &&
@@ -447,7 +447,7 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodule
447
447
mkdir mod &&
448
448
git mv sub mod/sub 2>actual.err &&
449
449
test_cmp expect.err actual.err &&
450
- ! test -e sub &&
450
+ test_path_is_missing sub &&
451
451
test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
452
452
git -C mod/sub status &&
453
453
git update-index --refresh &&
@@ -460,7 +460,7 @@ test_expect_success 'mv --dry-run does not touch the submodule or .gitmodules' '
460
460
git submodule update &&
461
461
mkdir mod &&
462
462
git mv -n sub mod/sub 2>actual.err &&
463
- test -f sub/.git &&
463
+ test_path_is_file sub/.git &&
464
464
git diff-index --exit-code HEAD &&
465
465
git update-index --refresh &&
466
466
git diff-files --quiet -- sub .gitmodules
@@ -474,10 +474,10 @@ test_expect_success 'checking out a commit before submodule moved needs manual u
474
474
git status -s sub2 >actual &&
475
475
echo "?? sub2/" >expected &&
476
476
test_cmp expected actual &&
477
- ! test -f sub/.git &&
478
- test -f sub2/.git &&
477
+ test_path_is_missing sub/.git &&
478
+ test_path_is_file sub2/.git &&
479
479
git submodule update &&
480
- test -f sub/.git &&
480
+ test_path_is_file sub/.git &&
481
481
rm -rf sub2 &&
482
482
git diff-index --exit-code HEAD &&
483
483
git update-index --refresh &&
0 commit comments