Skip to content

Commit f31b322

Browse files
frapaparattogitster
authored andcommitted
t3310: replace test -f/-d with test_path_is_file/test_path_is_dir
Replace old-style path assertions with modern helpers that provide clearer diagnostic messages on failure. When test -f fails, the output gives no indication of what went wrong. These instances were found using: git grep "test -[efd]" t/ as suggested in the microproject ideas. Signed-off-by: Francesco Paparatto <francescopaparatto@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 67ad421 commit f31b322

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

t/t3310-notes-merge-manual-resolve.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ test_expect_success 'change notes in z' '
260260
'
261261

262262
test_expect_success 'cannot do merge w/conflicts when previous merge is unfinished' '
263-
test -d .git/NOTES_MERGE_WORKTREE &&
263+
test_path_is_dir .git/NOTES_MERGE_WORKTREE &&
264264
test_must_fail git notes merge z >output 2>&1 &&
265265
# Output should indicate what is wrong
266266
test_grep -q "\\.git/NOTES_MERGE_\\* exists" output
@@ -320,7 +320,7 @@ w notes on 1st commit
320320
EOF
321321

322322
test_expect_success 'can do merge without conflicts even if previous merge is unfinished (x => w)' '
323-
test -d .git/NOTES_MERGE_WORKTREE &&
323+
test_path_is_dir .git/NOTES_MERGE_WORKTREE &&
324324
git notes merge x &&
325325
verify_notes w &&
326326
# Verify that other notes refs has not changed (x and y)
@@ -564,10 +564,10 @@ EOF
564564
# NOTES_MERGE_* refs and .git/NOTES_MERGE_* state files must remain
565565
git rev-parse --verify NOTES_MERGE_PARTIAL &&
566566
git rev-parse --verify NOTES_MERGE_REF &&
567-
test -f .git/NOTES_MERGE_WORKTREE/$commit_sha1 &&
568-
test -f .git/NOTES_MERGE_WORKTREE/$commit_sha2 &&
569-
test -f .git/NOTES_MERGE_WORKTREE/$commit_sha3 &&
570-
test -f .git/NOTES_MERGE_WORKTREE/$commit_sha4 &&
567+
test_path_is_file .git/NOTES_MERGE_WORKTREE/$commit_sha1 &&
568+
test_path_is_file .git/NOTES_MERGE_WORKTREE/$commit_sha2 &&
569+
test_path_is_file .git/NOTES_MERGE_WORKTREE/$commit_sha3 &&
570+
test_path_is_file .git/NOTES_MERGE_WORKTREE/$commit_sha4 &&
571571
# Refs are unchanged
572572
test "$(git rev-parse refs/notes/m)" = "$(git rev-parse refs/notes/w)" &&
573573
test "$(git rev-parse refs/notes/y)" = "$(git rev-parse NOTES_MERGE_PARTIAL^1)" &&

0 commit comments

Comments
 (0)