# [PATCH 0/7] move builtin help test to t1517

8 messages from 2025-07-06 to 2025-07-06. Participants: Usman Akinyemi.
Thread: https://gitlist.dev/t/63750

## Usman Akinyemi, 2025-07-06 21:07

Subject: [PATCH 0/7] move builtin help test to t1517
Message-ID: <20250706210725.79903-1-usmanakinyemi202@gmail.com>
URL: https://gitlist.dev/e/20250706210725.79903-1-usmanakinyemi202%40gmail.com

```
In patch series which contain this
"[*]: 43a8391977 (builtin/verify-tag: stop using `the_repository`, 2025-03-07)"
and some other builtin commands, the help test was added into their
respective test files. Since it better fits thats tests that check
command behavior outside a repository should be in t/t1517-outside-repo.sh.
Patrick suggest moving the test to t/t1517-outside-repo.sh.

This patch series moved the all the test.

Usman Akinyemi (7):
  t/t1517: move checkout-index -h test to t1517
  t/t1517: move for-each-ref -h test to t1517
  t/t1517: move ls-files -h test to t1517
  t/t1517: move pack-refs -h test to t1517
  t/t1517: move send-pack -h test to t1517
  t/t1517: move verify-commit -h test to t1517
  t/t1517: move verify-tag -h test to t1517

 t/t0610-reftable-basics.sh      |  7 -----
 t/t1517-outside-repo.sh         | 49 +++++++++++++++++++++++++++++++++
 t/t2006-checkout-index-basic.sh |  7 -----
 t/t3004-ls-files-basic.sh       |  7 -----
 t/t5400-send-pack.sh            |  7 -----
 t/t6300-for-each-ref.sh         |  7 -----
 t/t7030-verify-tag.sh           |  7 -----
 t/t7510-signed-commit.sh        |  7 -----
 8 files changed, 49 insertions(+), 49 deletions(-)

-- 
2.50.0


```

## Usman Akinyemi, 2025-07-06 21:07

Subject: [PATCH 1/7] t/t1517: move checkout-index -h test to t1517
Message-ID: <20250706210725.79903-2-usmanakinyemi202@gmail.com>
URL: https://gitlist.dev/e/20250706210725.79903-2-usmanakinyemi202%40gmail.com
In-Reply-To: <20250706210725.79903-1-usmanakinyemi202@gmail.com>

```
The test 'checkout-index does not crash with -h' checks that
the command exits cleanly with usage information, both inside and
outside of a repository.

Move this test from "t2006-checkout-index-basic.sh" to
"t1517-outside-repo.sh" since it better fits with tests that check
command behavior outside a repository.

Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
---
 t/t1517-outside-repo.sh         | 7 +++++++
 t/t2006-checkout-index-basic.sh | 7 -------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/t/t1517-outside-repo.sh b/t/t1517-outside-repo.sh
index 6824581317..98a453db58 100755
--- a/t/t1517-outside-repo.sh
+++ b/t/t1517-outside-repo.sh
@@ -114,4 +114,11 @@ test_expect_success 'update-server-info does not crash with -h' '
 	test_grep "[Uu]sage: git update-server-info " usage
 '
 
+test_expect_success 'checkout-index does not crash with -h' '
+	test_expect_code 129 git checkout-index -h >usage &&Add commentMore actions
+	test_grep "[Uu]sage: git checkout-index " usage &&
+	test_expect_code 129 nongit git checkout-index -h >usage &&
+	test_grep "[Uu]sage: git checkout-index " usage
+'
+
 test_done
diff --git a/t/t2006-checkout-index-basic.sh b/t/t2006-checkout-index-basic.sh
index fedd2cc097..bac231b167 100755
--- a/t/t2006-checkout-index-basic.sh
+++ b/t/t2006-checkout-index-basic.sh
@@ -21,13 +21,6 @@ test_expect_success 'checkout-index -h in broken repository' '
 	test_grep "[Uu]sage" broken/usage
 '
 
-test_expect_success 'checkout-index does not crash with -h' '
-	test_expect_code 129 git checkout-index -h >usage &&
-	test_grep "[Uu]sage: git checkout-index " usage &&
-	test_expect_code 129 nongit git checkout-index -h >usage &&
-	test_grep "[Uu]sage: git checkout-index " usage
-'
-
 test_expect_success 'checkout-index reports errors (cmdline)' '
 	test_must_fail git checkout-index -- does-not-exist 2>stderr &&
 	test_grep not.in.the.cache stderr
-- 
2.50.0


```

## Usman Akinyemi, 2025-07-06 21:07

Subject: [PATCH 2/7] t/t1517: move for-each-ref -h test to t1517
Message-ID: <20250706210725.79903-3-usmanakinyemi202@gmail.com>
URL: https://gitlist.dev/e/20250706210725.79903-3-usmanakinyemi202%40gmail.com
In-Reply-To: <20250706210725.79903-1-usmanakinyemi202@gmail.com>

```
The test 'for-each-ref does not crash with -h' checks that
the command exits cleanly with usage information, both inside and
outside of a repository.

Move this test from "t6300-for-each-ref.sh" to
"t1517-outside-repo.sh" since it better fits with tests that check
command behavior outside a repository.

Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
---
 t/t1517-outside-repo.sh | 7 +++++++
 t/t6300-for-each-ref.sh | 7 -------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/t/t1517-outside-repo.sh b/t/t1517-outside-repo.sh
index 98a453db58..92ad159b58 100755
--- a/t/t1517-outside-repo.sh
+++ b/t/t1517-outside-repo.sh
@@ -121,4 +121,11 @@ test_expect_success 'checkout-index does not crash with -h' '
 	test_grep "[Uu]sage: git checkout-index " usage
 '
 
+test_expect_success 'for-each-ref does not crash with -h' '
+	test_expect_code 129 git for-each-ref -h >usage &&
+	test_grep "[Uu]sage: git for-each-ref " usage &&
+	test_expect_code 129 nongit git for-each-ref -h >usage &&
+	test_grep "[Uu]sage: git for-each-ref " usage
+'
+
 test_done
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index ce9af79ab1..5db7038c41 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -292,13 +292,6 @@ test_expect_success 'Check invalid atoms names are errors' '
 	test_must_fail git for-each-ref --format="%(INVALID)" refs/heads
 '
 
-test_expect_success 'for-each-ref does not crash with -h' '
-	test_expect_code 129 git for-each-ref -h >usage &&
-	test_grep "[Uu]sage: git for-each-ref " usage &&
-	test_expect_code 129 nongit git for-each-ref -h >usage &&
-	test_grep "[Uu]sage: git for-each-ref " usage
-'
-
 test_expect_success 'Check format specifiers are ignored in naming date atoms' '
 	git for-each-ref --format="%(authordate)" refs/heads &&
 	git for-each-ref --format="%(authordate:default) %(authordate)" refs/heads &&
-- 
2.50.0


```

## Usman Akinyemi, 2025-07-06 21:07

Subject: [PATCH 3/7] t/t1517: move ls-files -h test to t1517
Message-ID: <20250706210725.79903-4-usmanakinyemi202@gmail.com>
URL: https://gitlist.dev/e/20250706210725.79903-4-usmanakinyemi202%40gmail.com
In-Reply-To: <20250706210725.79903-1-usmanakinyemi202@gmail.com>

```
The test 'ls-files does not crash with -h' checks that
the command exits cleanly with usage information, both inside and
outside of a repository.

Move this test from "t3004-ls-files-basic.sh" to
"t1517-outside-repo.sh" since it better fits with tests that check
command behavior outside a repository.

Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
---
 t/t1517-outside-repo.sh   | 7 +++++++
 t/t3004-ls-files-basic.sh | 7 -------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/t/t1517-outside-repo.sh b/t/t1517-outside-repo.sh
index 92ad159b58..e04be2d811 100755
--- a/t/t1517-outside-repo.sh
+++ b/t/t1517-outside-repo.sh
@@ -128,4 +128,11 @@ test_expect_success 'for-each-ref does not crash with -h' '
 	test_grep "[Uu]sage: git for-each-ref " usage
 '
 
+test_expect_success 'ls-files does not crash with -h' '
+	test_expect_code 129 git ls-files -h >usage &&
+	test_grep "[Uu]sage: git ls-files " usage &&
+	test_expect_code 129 nongit git ls-files -h >usage &&
+	test_grep "[Uu]sage: git ls-files " usage
+'
+
 test_done
diff --git a/t/t3004-ls-files-basic.sh b/t/t3004-ls-files-basic.sh
index 4034a5a59f..a1078f8701 100755
--- a/t/t3004-ls-files-basic.sh
+++ b/t/t3004-ls-files-basic.sh
@@ -34,13 +34,6 @@ test_expect_success 'ls-files -h in corrupt repository' '
 	test_grep "[Uu]sage: git ls-files " broken/usage
 '
 
-test_expect_success 'ls-files does not crash with -h' '
-	test_expect_code 129 git ls-files -h >usage &&
-	test_grep "[Uu]sage: git ls-files " usage &&
-	test_expect_code 129 nongit git ls-files -h >usage &&
-	test_grep "[Uu]sage: git ls-files " usage
-'
-
 test_expect_success SYMLINKS 'ls-files with absolute paths to symlinks' '
 	mkdir subs &&
 	ln -s nosuch link &&
-- 
2.50.0


```

## Usman Akinyemi, 2025-07-06 21:07

Subject: [PATCH 4/7] t/t1517: move pack-refs -h test to t1517
Message-ID: <20250706210725.79903-5-usmanakinyemi202@gmail.com>
URL: https://gitlist.dev/e/20250706210725.79903-5-usmanakinyemi202%40gmail.com
In-Reply-To: <20250706210725.79903-1-usmanakinyemi202@gmail.com>

```
The test 'pack-refs does not crash with -h' checks that
the command exits cleanly with usage information, both inside and
outside of a repository.

Move this test from "t0610-reftable-basics.sh" to
"t1517-outside-repo.sh" since it better fits with tests that check
command behavior outside a repository.

Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
---
 t/t0610-reftable-basics.sh | 7 -------
 t/t1517-outside-repo.sh    | 7 +++++++
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh
index 3ea5d51532..ffd8ecc0ce 100755
--- a/t/t0610-reftable-basics.sh
+++ b/t/t0610-reftable-basics.sh
@@ -14,13 +14,6 @@ export GIT_TEST_DEFAULT_REF_FORMAT
 
 INVALID_OID=$(test_oid 001)
 
-test_expect_success 'pack-refs does not crash with -h' '
-	test_expect_code 129 git pack-refs -h >usage &&
-	test_grep "[Uu]sage: git pack-refs " usage &&
-	test_expect_code 129 nongit git pack-refs -h >usage &&
-	test_grep "[Uu]sage: git pack-refs " usage
-'
-
 test_expect_success 'init: creates basic reftable structures' '
 	test_when_finished "rm -rf repo" &&
 	git init repo &&
diff --git a/t/t1517-outside-repo.sh b/t/t1517-outside-repo.sh
index e04be2d811..5b4373f8cd 100755
--- a/t/t1517-outside-repo.sh
+++ b/t/t1517-outside-repo.sh
@@ -135,4 +135,11 @@ test_expect_success 'ls-files does not crash with -h' '
 	test_grep "[Uu]sage: git ls-files " usage
 '
 
+test_expect_success 'pack-refs does not crash with -h' '
+	test_expect_code 129 git pack-refs -h >usage &&
+	test_grep "[Uu]sage: git pack-refs " usage &&
+	test_expect_code 129 nongit git pack-refs -h >usage &&
+	test_grep "[Uu]sage: git pack-refs " usage
+'
+
 test_done
-- 
2.50.0


```

## Usman Akinyemi, 2025-07-06 21:07

Subject: [PATCH 5/7] t/t1517: move send-pack -h test to t1517
Message-ID: <20250706210725.79903-6-usmanakinyemi202@gmail.com>
URL: https://gitlist.dev/e/20250706210725.79903-6-usmanakinyemi202%40gmail.com
In-Reply-To: <20250706210725.79903-1-usmanakinyemi202@gmail.com>

```
The test 'send-pack does not crash with -h' checks that
the command exits cleanly with usage information, both inside and
outside of a repository.

Move this test from "t/t5400-send-pack.sh" to
"t1517-outside-repo.sh" since it better fits with tests that check
command behavior outside a repository.

Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
---
 t/t1517-outside-repo.sh | 7 +++++++
 t/t5400-send-pack.sh    | 7 -------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/t/t1517-outside-repo.sh b/t/t1517-outside-repo.sh
index 5b4373f8cd..a140b5cc38 100755
--- a/t/t1517-outside-repo.sh
+++ b/t/t1517-outside-repo.sh
@@ -142,4 +142,11 @@ test_expect_success 'pack-refs does not crash with -h' '
 	test_grep "[Uu]sage: git pack-refs " usage
 '
 
+test_expect_success 'send-pack does not crash with -h' '
+	test_expect_code 129 git send-pack -h >usage &&
+	test_grep "[Uu]sage: git send-pack " usage &&
+	test_expect_code 129 nongit git send-pack -h >usage &&
+	test_grep "[Uu]sage: git send-pack " usage
+'
+
 test_done
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
index 83b42ff073..571e8f1bc5 100755
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
@@ -55,13 +55,6 @@ test_expect_success setup '
 	echo Rebase &&
 	git log'
 
-test_expect_success 'send-pack does not crash with -h' '
-	test_expect_code 129 git send-pack -h >usage &&
-	test_grep "[Uu]sage: git send-pack " usage &&
-	test_expect_code 129 nongit git send-pack -h >usage &&
-	test_grep "[Uu]sage: git send-pack " usage
-'
-
 test_expect_success 'pack the source repository' '
 	git repack -a -d &&
 	git prune
-- 
2.50.0


```

## Usman Akinyemi, 2025-07-06 21:07

Subject: [PATCH 6/7] t/t1517: move verify-commit -h test to t1517
Message-ID: <20250706210725.79903-7-usmanakinyemi202@gmail.com>
URL: https://gitlist.dev/e/20250706210725.79903-7-usmanakinyemi202%40gmail.com
In-Reply-To: <20250706210725.79903-1-usmanakinyemi202@gmail.com>

```
The test 'verify-commit does not crash with -h' checks that
the command exits cleanly with usage information, both inside and
outside of a repository.

Move this test from "t/t7510-signed-commit.sh" to
"t1517-outside-repo.sh" since it better fits with tests that check
command behavior outside a repository.

Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
---
 t/t1517-outside-repo.sh  | 7 +++++++
 t/t7510-signed-commit.sh | 7 -------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/t/t1517-outside-repo.sh b/t/t1517-outside-repo.sh
index a140b5cc38..42381ef7eb 100755
--- a/t/t1517-outside-repo.sh
+++ b/t/t1517-outside-repo.sh
@@ -149,4 +149,11 @@ test_expect_success 'send-pack does not crash with -h' '
 	test_grep "[Uu]sage: git send-pack " usage
 '
 
+test_expect_success 'verify-commit does not crash with -h' '
+	test_expect_code 129 git verify-commit -h >usage &&
+	test_grep "[Uu]sage: git verify-commit " usage &&
+	test_expect_code 129 nongit git verify-commit -h >usage &&
+	test_grep "[Uu]sage: git verify-commit " usage
+'
+
 test_done
diff --git a/t/t7510-signed-commit.sh b/t/t7510-signed-commit.sh
index 39677e859a..0d2dd29fe6 100755
--- a/t/t7510-signed-commit.sh
+++ b/t/t7510-signed-commit.sh
@@ -8,13 +8,6 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 GNUPGHOME_NOT_USED=$GNUPGHOME
 . "$TEST_DIRECTORY/lib-gpg.sh"
 
-test_expect_success GPG 'verify-commit does not crash with -h' '
-	test_expect_code 129 git verify-commit -h >usage &&
-	test_grep "[Uu]sage: git verify-commit " usage &&
-	test_expect_code 129 nongit git verify-commit -h >usage &&
-	test_grep "[Uu]sage: git verify-commit " usage
-'
-
 test_expect_success GPG 'create signed commits' '
 	test_oid_cache <<-\EOF &&
 	header sha1:gpgsig
-- 
2.50.0


```

## Usman Akinyemi, 2025-07-06 21:07

Subject: [PATCH 7/7] t/t1517: move verify-tag -h test to t1517
Message-ID: <20250706210725.79903-8-usmanakinyemi202@gmail.com>
URL: https://gitlist.dev/e/20250706210725.79903-8-usmanakinyemi202%40gmail.com
In-Reply-To: <20250706210725.79903-1-usmanakinyemi202@gmail.com>

```
The test 'verify-tag does not crash with -h' checks that
the command exits cleanly with usage information, both inside and
outside of a repository.

Move this test from "t/t7030-verify-tag.sh" to
"t1517-outside-repo.sh" since it better fits with tests that check
command behavior outside a repository.

Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
---
 t/t1517-outside-repo.sh | 7 +++++++
 t/t7030-verify-tag.sh   | 7 -------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/t/t1517-outside-repo.sh b/t/t1517-outside-repo.sh
index 42381ef7eb..0755757d86 100755
--- a/t/t1517-outside-repo.sh
+++ b/t/t1517-outside-repo.sh
@@ -156,4 +156,11 @@ test_expect_success 'verify-commit does not crash with -h' '
 	test_grep "[Uu]sage: git verify-commit " usage
 '
 
+test_expect_success 'verify-tag does not crash with -h' '
+	test_expect_code 129 git verify-tag -h >usage &&
+	test_grep "[Uu]sage: git verify-tag " usage &&
+	test_expect_code 129 nongit git verify-tag -h >usage &&
+	test_grep "[Uu]sage: git verify-tag " usage
+'
+
 test_done
diff --git a/t/t7030-verify-tag.sh b/t/t7030-verify-tag.sh
index 2c147072c1..6f526c37c2 100755
--- a/t/t7030-verify-tag.sh
+++ b/t/t7030-verify-tag.sh
@@ -7,13 +7,6 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 . ./test-lib.sh
 . "$TEST_DIRECTORY/lib-gpg.sh"
 
-test_expect_success GPG 'verify-tag does not crash with -h' '
-	test_expect_code 129 git verify-tag -h >usage &&
-	test_grep "[Uu]sage: git verify-tag " usage &&
-	test_expect_code 129 nongit git verify-tag -h >usage &&
-	test_grep "[Uu]sage: git verify-tag " usage
-'
-
 test_expect_success GPG 'create signed tags' '
 	echo 1 >file && git add file &&
 	test_tick && git commit -m initial &&
-- 
2.50.0


```
