Git fork

t7611: replace test -f with test_path_is* helpers

Replace `test -f` and `test ! -f` with `test_path_is_file` and
`test_path_is_missing` for better debuggability.

While `test -f` ensures that the file exists and is a regular file,
`test_path_is_file` provides clearer error messages on failure.

On the other hand, `test ! -f` checks either the absence of a regular
file or the presence of any other filesystem object, but looking at
them in the test individually, all of them should've said `test ! -e`,
i.e. "there shouldn't be anything at given path on filesystem."

Replace these cases with `test_path_is_missing` for better
debuggability.

Helped-by: karthik nayak <karthik.188@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Meet Soni <meetsoni3017@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Meet Soni and committed by
Junio C Hamano
cef3d4a8 76cf4f61

+17 -17
+17 -17
t/t7611-merge-abort.sh
··· 54 54 ' 55 55 56 56 test_expect_success 'fails without MERGE_HEAD (unstarted merge): .git/MERGE_HEAD sanity' ' 57 - test ! -f .git/MERGE_HEAD && 57 + test_path_is_missing .git/MERGE_HEAD && 58 58 test "$pre_merge_head" = "$(git rev-parse HEAD)" 59 59 ' 60 60 61 61 test_expect_success 'fails without MERGE_HEAD (completed merge)' ' 62 62 git merge clean_branch && 63 - test ! -f .git/MERGE_HEAD && 63 + test_path_is_missing .git/MERGE_HEAD && 64 64 # Merge successfully completed 65 65 post_merge_head="$(git rev-parse HEAD)" && 66 66 test_must_fail git merge --abort 2>output && ··· 68 68 ' 69 69 70 70 test_expect_success 'fails without MERGE_HEAD (completed merge): .git/MERGE_HEAD sanity' ' 71 - test ! -f .git/MERGE_HEAD && 71 + test_path_is_missing .git/MERGE_HEAD && 72 72 test "$post_merge_head" = "$(git rev-parse HEAD)" 73 73 ' 74 74 ··· 79 79 test_expect_success 'Abort after --no-commit' ' 80 80 # Redo merge, but stop before creating merge commit 81 81 git merge --no-commit clean_branch && 82 - test -f .git/MERGE_HEAD && 82 + test_path_is_file .git/MERGE_HEAD && 83 83 # Abort non-conflicting merge 84 84 git merge --abort && 85 - test ! -f .git/MERGE_HEAD && 85 + test_path_is_missing .git/MERGE_HEAD && 86 86 test "$pre_merge_head" = "$(git rev-parse HEAD)" && 87 87 test -z "$(git diff)" && 88 88 test -z "$(git diff --staged)" ··· 91 91 test_expect_success 'Abort after conflicts' ' 92 92 # Create conflicting merge 93 93 test_must_fail git merge conflict_branch && 94 - test -f .git/MERGE_HEAD && 94 + test_path_is_file .git/MERGE_HEAD && 95 95 # Abort conflicting merge 96 96 git merge --abort && 97 - test ! -f .git/MERGE_HEAD && 97 + test_path_is_missing .git/MERGE_HEAD && 98 98 test "$pre_merge_head" = "$(git rev-parse HEAD)" && 99 99 test -z "$(git diff)" && 100 100 test -z "$(git diff --staged)" ··· 105 105 git add foo && 106 106 git diff --staged > expect && 107 107 test_must_fail git merge clean_branch && 108 - test ! -f .git/MERGE_HEAD && 108 + test_path_is_missing .git/MERGE_HEAD && 109 109 test "$pre_merge_head" = "$(git rev-parse HEAD)" && 110 110 test -z "$(git diff)" && 111 111 git diff --staged > actual && ··· 114 114 115 115 test_expect_success 'Conflicting merge with dirty index fails' ' 116 116 test_must_fail git merge conflict_branch && 117 - test ! -f .git/MERGE_HEAD && 117 + test_path_is_missing .git/MERGE_HEAD && 118 118 test "$pre_merge_head" = "$(git rev-parse HEAD)" && 119 119 test -z "$(git diff)" && 120 120 git diff --staged > actual && ··· 129 129 130 130 test_expect_success 'Abort clean merge with non-conflicting dirty worktree' ' 131 131 git merge --no-commit clean_branch && 132 - test -f .git/MERGE_HEAD && 132 + test_path_is_file .git/MERGE_HEAD && 133 133 # Abort merge 134 134 git merge --abort && 135 - test ! -f .git/MERGE_HEAD && 135 + test_path_is_missing .git/MERGE_HEAD && 136 136 test "$pre_merge_head" = "$(git rev-parse HEAD)" && 137 137 test -z "$(git diff --staged)" && 138 138 git diff > actual && ··· 141 141 142 142 test_expect_success 'Abort conflicting merge with non-conflicting dirty worktree' ' 143 143 test_must_fail git merge conflict_branch && 144 - test -f .git/MERGE_HEAD && 144 + test_path_is_file .git/MERGE_HEAD && 145 145 # Abort merge 146 146 git merge --abort && 147 - test ! -f .git/MERGE_HEAD && 147 + test_path_is_missing .git/MERGE_HEAD && 148 148 test "$pre_merge_head" = "$(git rev-parse HEAD)" && 149 149 test -z "$(git diff --staged)" && 150 150 git diff > actual && ··· 159 159 echo xyzzy >> bar && 160 160 git diff > expect && 161 161 test_must_fail git merge --no-commit clean_branch && 162 - test ! -f .git/MERGE_HEAD && 162 + test_path_is_missing .git/MERGE_HEAD && 163 163 test "$pre_merge_head" = "$(git rev-parse HEAD)" && 164 164 test -z "$(git diff --staged)" && 165 165 git diff > actual && ··· 168 168 169 169 test_expect_success 'Fail conflicting merge with conflicting dirty worktree' ' 170 170 test_must_fail git merge conflict_branch && 171 - test ! -f .git/MERGE_HEAD && 171 + test_path_is_missing .git/MERGE_HEAD && 172 172 test "$pre_merge_head" = "$(git rev-parse HEAD)" && 173 173 test -z "$(git diff --staged)" && 174 174 git diff > actual && ··· 183 183 echo bart > bar && 184 184 git diff > expect && 185 185 test_must_fail git merge --no-commit clean_branch && 186 - test ! -f .git/MERGE_HEAD && 186 + test_path_is_missing .git/MERGE_HEAD && 187 187 test "$pre_merge_head" = "$(git rev-parse HEAD)" && 188 188 test -z "$(git diff --staged)" && 189 189 git diff > actual && ··· 194 194 echo barf > bar && 195 195 git diff > expect && 196 196 test_must_fail git merge conflict_branch && 197 - test ! -f .git/MERGE_HEAD && 197 + test_path_is_missing .git/MERGE_HEAD && 198 198 test "$pre_merge_head" = "$(git rev-parse HEAD)" && 199 199 test -z "$(git diff --staged)" && 200 200 git diff > actual &&