Skip to contentSkip to conversation

t3429: use test_path_is_file helper

PATCH In review Joy via GitGitGadget 3 participants 3 messages Oct 21 – Oct 22

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t3429: use test_path_is_file helper

From: Joy Gundu <[email protected]>

---
t3429: use test_path_is_file helper

Replace test -e F with test_path_is_file F in t3429-rebase-edit-todo.sh to use Git's semantic test helper and provide better diagnostics on failure.

Tested with:

make NO_ICONV=YesPlease test T=t3429-rebase-edit-todo.sh

All 7 tests passed.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2274%2FJoiejoie1%2Foutreachy%2Ftest-path-helper-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2274/Joiejoie1/outreachy/test-path-helper-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2274

 t/t3429-rebase-edit-todo.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
t/t3429-rebase-edit-todo.sh +1 -1
index 28e4bdd0d9..a421c35d8a 100755
@@ -14,7 +14,7 @@ test_expect_success 'setup' '
 test_expect_success 'rebase exec modifies rebase-todo' '
 	todo=.git/rebase-merge/git-rebase-todo &&
 	git rebase HEAD~1 -x "echo exec touch F >>$todo" &&
-	test -e F
+	test_path_is_file F
 '
 
 test_expect_success 'rebase exec with an empty list does not exec anything' '

base-commit: c51408889c3b372814bc20b9431c3b74d0d268eb

Signature · 1 line
gitgitgadget
#1 lore raw
Quoted 9 lines · Joy via GitGitGadget

From: Joy Gundu <[email protected]>

---
t3429: use test_path_is_file helper

Replace test -e F with test_path_is_file F in t3429-rebase-edit-todo.sh to use Git's semantic test helper and provide better diagnostics on

Why is the commit message down after the dashes, isn't is supposed to be at the top?

t/t3429-rebase-edit-todo.sh test_expect_success 'setup' ' · line 17

Quoted 4 lines
        todo=.git/rebase-merge/git-rebase-todo &&
        git rebase HEAD~1 -x "echo exec touch F >>$todo" &&
t/t3429-rebase-edit-todo.sh +1 -1
-       test -e F
+       test_path_is_file F

This is wrong, the initial patch is testing whether "F" exists, not whether it is a file. The appropriate function to use here is test_patch_exists.

Quoted 7 lines

'

test_expect_success 'rebase exec with an empty list does not exec anything' '

base-commit: c51408889c3b372814bc20b9431c3b74d0d268eb --
gitgitgadget

#2 lore raw
Quoted 5 lines · Usman Akinyemi
Quoted 3 lines · Joy via GitGitGadget

From: Joy Gundu <[email protected]>

Quoted 8 lines
Quoted 6 lines

---
t3429: use test_path_is_file helper

Replace test -e F with test_path_is_file F in t3429-rebase-edit-todo.sh to use Git's semantic test helper and provide better diagnostics on

Why is the commit message down after the dashes, isn't is supposed to be at the top?

(tip: leave a blank line between what they write and what you write, both before and after)

It is a common mistake of GGG users. When they write an empty commit message and then elaborate in the pull request message, we see something like what we are looking at.

Quoted 13 lines

t/t3429-rebase-edit-todo.sh test_expect_success 'setup' ' · line 17

Quoted 4 lines
        todo=.git/rebase-merge/git-rebase-todo &&
        git rebase HEAD~1 -x "echo exec touch F >>$todo" &&
t/t3429-rebase-edit-todo.sh +1 -1
-       test -e F
+       test_path_is_file F

This is wrong, the initial patch is testing whether "F" exists, not whether it is a file. The appropriate function to use here is test_patch_exists.

Quoted 7 lines

'

test_expect_success 'rebase exec with an empty list does not exec anything' '

base-commit: c51408889c3b372814bc20b9431c3b74d0d268eb --
gitgitgadget