Skip to contentSkip to conversation

t5401: prefer test_path_is_* helper function

PATCH In review ambar chakravartty 3 participants 4 messages Feb 1, 2025 – Feb 2, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t5401: prefer test_path_is_* helper function

From: ambar chakravartty <[email protected]>

test -f does not provide a nice error message when we hit test failures, so use test_path_is_file instead

---
 t/t5401-update-hooks.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
t/t5401-update-hooks.sh +8 -8
index 723d1e17ec..17a46fd3ba 100755
@@ -64,14 +64,14 @@ test_expect_success 'updated as expected' '
 '
 
 test_expect_success 'hooks ran' '
-	test -f victim.git/pre-receive.args &&
-	test -f victim.git/pre-receive.stdin &&
-	test -f victim.git/update.args &&
-	test -f victim.git/update.stdin &&
-	test -f victim.git/post-receive.args &&
-	test -f victim.git/post-receive.stdin &&
-	test -f victim.git/post-update.args &&
-	test -f victim.git/post-update.stdin
+	test_path_is_file victim.git/pre-receive.args &&
+	test_path_is_file victim.git/pre-receive.stdin &&
+	test_path_is_file victim.git/update.args &&
+	test_path_is_file victim.git/update.stdin &&
+	test_path_is_file victim.git/post-receive.args &&
+	test_path_is_file victim.git/post-receive.stdin &&
+	test_path_is_file victim.git/post-update.args &&
+	test_path_is_file victim.git/post-update.stdin
 '
 
 test_expect_success 'pre-receive hook input' '
Signature · 1 line
2.48.1
#1 lore raw

Hi Ambar

Quoted 8 lines · ambar chakravartty

From: ambar chakravartty <[email protected]>

test -f does not provide a nice error message when we hit test failures, so use test_path_is_file instead

---

Instead of sending a separate cover letter, you can add it here between
"---" and diffstat.
cf. https://github.com/git/git/blob/58b5801aa94ad5031978f8e42c1be1230b3d352f/Documentation/MyFirstContribution.txt#L1220

Quoted 31 lines
 t/t5401-update-hooks.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
t/t5401-update-hooks.sh +8 -9
index 723d1e17ec..17a46fd3ba 100755
@@ -64,14 +64,14 @@ test_expect_success 'updated as expected' '
 '
 
 test_expect_success 'hooks ran' '
-       test -f victim.git/pre-receive.args &&
-       test -f victim.git/pre-receive.stdin &&
-       test -f victim.git/update.args &&
-       test -f victim.git/update.stdin &&
-       test -f victim.git/post-receive.args &&
-       test -f victim.git/post-receive.stdin &&
-       test -f victim.git/post-update.args &&
-       test -f victim.git/post-update.stdin
+       test_path_is_file victim.git/pre-receive.args &&
+       test_path_is_file victim.git/pre-receive.stdin &&
+       test_path_is_file victim.git/update.args &&
+       test_path_is_file victim.git/update.stdin &&
+       test_path_is_file victim.git/post-receive.args &&
+       test_path_is_file victim.git/post-receive.stdin &&
+       test_path_is_file victim.git/post-update.args &&
+       test_path_is_file victim.git/post-update.stdin
 '
 
 test_expect_success 'pre-receive hook input' '
--
Quoted 3 lines

2.48.1

The patch looks great! Thanks.
Meet

author
#2 lore raw
Quoted 2 lines

Instead of sending a separate cover letter, you can add it here between "---" and diffstat.

Understood.
Should I resend this patch with the change ?

Quoted 1 line

The patch looks great! Thanks.

Thank you for your time and feedback :-)

Ambar

Quoted 50 lines · Meet Soni

Hi Ambar

Quoted 8 lines · ambar chakravartty

From: ambar chakravartty <[email protected]>

test -f does not provide a nice error message when we hit test failures, so use test_path_is_file instead

---

Instead of sending a separate cover letter, you can add it here between
"---" and diffstat.
cf. https://github.com/git/git/blob/58b5801aa94ad5031978f8e42c1be1230b3d352f/Documentation/MyFirstContribution.txt#L1220

Quoted 31 lines
 t/t5401-update-hooks.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
t/t5401-update-hooks.sh +8 -9
index 723d1e17ec..17a46fd3ba 100755
@@ -64,14 +64,14 @@ test_expect_success 'updated as expected' '
 '
 
 test_expect_success 'hooks ran' '
-       test -f victim.git/pre-receive.args &&
-       test -f victim.git/pre-receive.stdin &&
-       test -f victim.git/update.args &&
-       test -f victim.git/update.stdin &&
-       test -f victim.git/post-receive.args &&
-       test -f victim.git/post-receive.stdin &&
-       test -f victim.git/post-update.args &&
-       test -f victim.git/post-update.stdin
+       test_path_is_file victim.git/pre-receive.args &&
+       test_path_is_file victim.git/pre-receive.stdin &&
+       test_path_is_file victim.git/update.args &&
+       test_path_is_file victim.git/update.stdin &&
+       test_path_is_file victim.git/post-receive.args &&
+       test_path_is_file victim.git/post-receive.stdin &&
+       test_path_is_file victim.git/post-update.args &&
+       test_path_is_file victim.git/post-update.stdin
 '
 
 test_expect_success 'pre-receive hook input' '
--
Quoted 3 lines

2.48.1

The patch looks great! Thanks.
Meet

#3 lore raw
In reply to ambar chakravartty
Quoted 7 lines · ambar chakravartty

From: ambar chakravartty <[email protected]>

test -f does not provide a nice error message when we hit test failures, so use test_path_is_file instead

---

Much better. You do not have to and you should not indent the proposed log message, and you want the full-stop (.) at the end of the word "instead" at the end of the sentence, but other than that this looks very good.

Will queue after tweaking the log message.

Thanks.

Quoted 30 lines
 t/t5401-update-hooks.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
t/t5401-update-hooks.sh +8 -8
index 723d1e17ec..17a46fd3ba 100755
@@ -64,14 +64,14 @@ test_expect_success 'updated as expected' '
 '
 
 test_expect_success 'hooks ran' '
-	test -f victim.git/pre-receive.args &&
-	test -f victim.git/pre-receive.stdin &&
-	test -f victim.git/update.args &&
-	test -f victim.git/update.stdin &&
-	test -f victim.git/post-receive.args &&
-	test -f victim.git/post-receive.stdin &&
-	test -f victim.git/post-update.args &&
-	test -f victim.git/post-update.stdin
+	test_path_is_file victim.git/pre-receive.args &&
+	test_path_is_file victim.git/pre-receive.stdin &&
+	test_path_is_file victim.git/update.args &&
+	test_path_is_file victim.git/update.stdin &&
+	test_path_is_file victim.git/post-receive.args &&
+	test_path_is_file victim.git/post-receive.stdin &&
+	test_path_is_file victim.git/post-update.args &&
+	test_path_is_file victim.git/post-update.stdin
 '
 
 test_expect_success 'pre-receive hook input' '