public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] t7412: fix typo 'submodue' in test_description
@ 2026-03-03 17:57 Yuvraj Singh Chauhan
  2026-03-03 17:57 ` [PATCH 2/2] t7412: modernize path checks to use test helper functions Yuvraj Singh Chauhan
  2026-03-04  5:16 ` [PATCH 1/2] t7412: fix typo 'submodue' in test_description Patrick Steinhardt
  0 siblings, 2 replies; 4+ messages in thread
From: Yuvraj Singh Chauhan @ 2026-03-03 17:57 UTC (permalink / raw)
  To: git; +Cc: gitster, Yuvraj Singh Chauhan

Signed-off-by: Yuvraj Singh Chauhan <ysinghcin@gmail.com>
---
 t/t7412-submodule-absorbgitdirs.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t7412-submodule-absorbgitdirs.sh b/t/t7412-submodule-absorbgitdirs.sh
index 0490499573..41ee035e3c 100755
--- a/t/t7412-submodule-absorbgitdirs.sh
+++ b/t/t7412-submodule-absorbgitdirs.sh
@@ -2,7 +2,7 @@
 
 test_description='Test submodule absorbgitdirs
 
-This test verifies that `git submodue absorbgitdirs` moves a submodules git
+This test verifies that `git submodule absorbgitdirs` moves a submodules git
 directory into the superproject.
 '
 
-- 
2.53.0.290.g4805bb9930


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] t7412: modernize path checks to use test helper functions
  2026-03-03 17:57 [PATCH 1/2] t7412: fix typo 'submodue' in test_description Yuvraj Singh Chauhan
@ 2026-03-03 17:57 ` Yuvraj Singh Chauhan
  2026-03-04  5:16   ` Patrick Steinhardt
  2026-03-04  5:16 ` [PATCH 1/2] t7412: fix typo 'submodue' in test_description Patrick Steinhardt
  1 sibling, 1 reply; 4+ messages in thread
From: Yuvraj Singh Chauhan @ 2026-03-03 17:57 UTC (permalink / raw)
  To: git; +Cc: gitster, Yuvraj Singh Chauhan

Replace 11 raw 'test -f', 'test -d', and '! test -e' calls with the
corresponding test library helpers:

  - 'test -f' -> 'test_path_is_file'
  - 'test -d' -> 'test_path_is_dir'
  - '! test -e' -> 'test_path_is_missing'

These helpers emit a descriptive message on failure, 
making failing tests easier to diagnose than the silent 
pass/fail of the raw shell primitives.

Signed-off-by: Yuvraj Singh Chauhan <ysinghcin@gmail.com>
---
 t/t7412-submodule-absorbgitdirs.sh | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/t/t7412-submodule-absorbgitdirs.sh b/t/t7412-submodule-absorbgitdirs.sh
index 41ee035e3c..cdc7f59e12 100755
--- a/t/t7412-submodule-absorbgitdirs.sh
+++ b/t/t7412-submodule-absorbgitdirs.sh
@@ -34,8 +34,8 @@ test_expect_success 'absorb the git dir' '
 	git submodule absorbgitdirs 2>actual &&
 	test_cmp expect actual &&
 	git fsck &&
-	test -f sub1/.git &&
-	test -d .git/modules/sub1 &&
+	test_path_is_file sub1/.git &&
+	test_path_is_dir .git/modules/sub1 &&
 	git status >actual.1 &&
 	git -C sub1 rev-parse HEAD >actual.2 &&
 	test_cmp expect.1 actual.1 &&
@@ -47,9 +47,9 @@ test_expect_success 'absorbing does not fail for deinitialized submodules' '
 	git submodule deinit --all &&
 	git submodule absorbgitdirs 2>err &&
 	test_must_be_empty err &&
-	test -d .git/modules/sub1 &&
-	test -d sub1 &&
-	! test -e sub1/.git
+	test_path_is_dir .git/modules/sub1 &&
+	test_path_is_dir sub1 &&
+	test_path_is_missing sub1/.git
 '
 
 test_expect_success 'setup nested submodule' '
@@ -72,8 +72,8 @@ test_expect_success 'absorb the git dir in a nested submodule' '
 	EOF
 	git submodule absorbgitdirs 2>actual &&
 	test_cmp expect actual &&
-	test -f sub1/nested/.git &&
-	test -d .git/modules/sub1/modules/nested &&
+	test_path_is_file sub1/nested/.git &&
+	test_path_is_dir .git/modules/sub1/modules/nested &&
 	git status >actual.1 &&
 	git -C sub1/nested rev-parse HEAD >actual.2 &&
 	test_cmp expect.1 actual.1 &&
@@ -109,9 +109,9 @@ test_expect_success 'absorb the git dir in a nested submodule' '
 	EOF
 	git submodule absorbgitdirs 2>actual &&
 	test_cmp expect actual &&
-	test -f sub1/.git &&
-	test -f sub1/nested/.git &&
-	test -d .git/modules/sub1/modules/nested &&
+	test_path_is_file sub1/.git &&
+	test_path_is_file sub1/nested/.git &&
+	test_path_is_dir .git/modules/sub1/modules/nested &&
 	git status >actual.1 &&
 	git -C sub1/nested rev-parse HEAD >actual.2 &&
 	test_cmp expect.1 actual.1 &&
@@ -155,7 +155,7 @@ test_expect_success 'absorbing the git dir fails for incomplete submodules' '
 	test_must_fail git submodule absorbgitdirs 2>actual &&
 	test_cmp expect actual &&
 	git -C sub2 fsck &&
-	test -d sub2/.git &&
+	test_path_is_dir sub2/.git &&
 	git status >actual &&
 	git -C sub2 rev-parse HEAD >actual.2 &&
 	test_cmp expect.1 actual.1 &&
-- 
2.53.0.290.g4805bb9930


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] t7412: fix typo 'submodue' in test_description
  2026-03-03 17:57 [PATCH 1/2] t7412: fix typo 'submodue' in test_description Yuvraj Singh Chauhan
  2026-03-03 17:57 ` [PATCH 2/2] t7412: modernize path checks to use test helper functions Yuvraj Singh Chauhan
@ 2026-03-04  5:16 ` Patrick Steinhardt
  1 sibling, 0 replies; 4+ messages in thread
From: Patrick Steinhardt @ 2026-03-04  5:16 UTC (permalink / raw)
  To: Yuvraj Singh Chauhan; +Cc: git, gitster

On Tue, Mar 03, 2026 at 11:27:49PM +0530, Yuvraj Singh Chauhan wrote:

One micro nit, not worth rerolling over: I think in general we prefer to
have at least a sentence in the commit message body, even if it repeats
most of what the subject has already said.

At least for me it makes the review a bit easier, as the subject of the
message will be gone at the time I start writing a reply during the
review.

> Signed-off-by: Yuvraj Singh Chauhan <ysinghcin@gmail.com>
> ---
>  t/t7412-submodule-absorbgitdirs.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/t/t7412-submodule-absorbgitdirs.sh b/t/t7412-submodule-absorbgitdirs.sh
> index 0490499573..41ee035e3c 100755
> --- a/t/t7412-submodule-absorbgitdirs.sh
> +++ b/t/t7412-submodule-absorbgitdirs.sh
> @@ -2,7 +2,7 @@
>  
>  test_description='Test submodule absorbgitdirs
>  
> -This test verifies that `git submodue absorbgitdirs` moves a submodules git
> +This test verifies that `git submodule absorbgitdirs` moves a submodules git
>  directory into the superproject.
>  '

An obvious fix indeed.

Patrick

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] t7412: modernize path checks to use test helper functions
  2026-03-03 17:57 ` [PATCH 2/2] t7412: modernize path checks to use test helper functions Yuvraj Singh Chauhan
@ 2026-03-04  5:16   ` Patrick Steinhardt
  0 siblings, 0 replies; 4+ messages in thread
From: Patrick Steinhardt @ 2026-03-04  5:16 UTC (permalink / raw)
  To: Yuvraj Singh Chauhan; +Cc: git, gitster

On Tue, Mar 03, 2026 at 11:27:50PM +0530, Yuvraj Singh Chauhan wrote:
> Replace 11 raw 'test -f', 'test -d', and '! test -e' calls with the

This explicit number of course made me verify that you didn't miscount,
and you indeed didn't :)

> corresponding test library helpers:
> 
>   - 'test -f' -> 'test_path_is_file'
>   - 'test -d' -> 'test_path_is_dir'
>   - '! test -e' -> 'test_path_is_missing'
> 
> These helpers emit a descriptive message on failure, 
> making failing tests easier to diagnose than the silent 
> pass/fail of the raw shell primitives.

Yup, the reasoning is sound.

By the way, you have trailing whitespace in the commit message. I guess
it'll get stripped when Junio applies the patch anyway, but maybe
something to watch out for in the future.

> diff --git a/t/t7412-submodule-absorbgitdirs.sh b/t/t7412-submodule-absorbgitdirs.sh
> index 41ee035e3c..cdc7f59e12 100755
> --- a/t/t7412-submodule-absorbgitdirs.sh
> +++ b/t/t7412-submodule-absorbgitdirs.sh

The changes all look obviously correct to me. Thanks!

Patrick

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-04  5:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-03 17:57 [PATCH 1/2] t7412: fix typo 'submodue' in test_description Yuvraj Singh Chauhan
2026-03-03 17:57 ` [PATCH 2/2] t7412: modernize path checks to use test helper functions Yuvraj Singh Chauhan
2026-03-04  5:16   ` Patrick Steinhardt
2026-03-04  5:16 ` [PATCH 1/2] t7412: fix typo 'submodue' in test_description Patrick Steinhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox