move builtin help test to t1517
v2 cover move builtin help test to t1517
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.
Changes since v1:
- Fix some typo
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(-)
Signature · 1 line
2.50.0
PATCH v2 1/7 t/t1517: move checkout-index -h test to t1517
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.
--- t/t1517-outside-repo.sh | 7 +++++++ t/t2006-checkout-index-basic.sh | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-)
t/t1517-outside-repo.sh +7 -0
@@ -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
t/t2006-checkout-index-basic.sh +0 -7
@@ -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
Signature · 1 line
2.50.0
PATCH v2 2/7 t/t1517: move for-each-ref -h test to t1517
In reply to Usman AkinyemiThe 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.
--- t/t1517-outside-repo.sh | 7 +++++++ t/t6300-for-each-ref.sh | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-)
t/t1517-outside-repo.sh +7 -0
@@ -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
t/t6300-for-each-ref.sh +0 -7
@@ -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 &&
Signature · 1 line
2.50.0
PATCH v2 3/7 t/t1517: move ls-files -h test to t1517
In reply to Usman AkinyemiThe 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.
--- t/t1517-outside-repo.sh | 7 +++++++ t/t3004-ls-files-basic.sh | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-)
t/t1517-outside-repo.sh +7 -0
@@ -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
t/t3004-ls-files-basic.sh +0 -7
@@ -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 &&
Signature · 1 line
2.50.0
PATCH v2 4/7 t/t1517: move pack-refs -h test to t1517
In reply to Usman AkinyemiThe 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.
--- t/t0610-reftable-basics.sh | 7 ------- t/t1517-outside-repo.sh | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-)
t/t0610-reftable-basics.sh +0 -7
@@ -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 &&
t/t1517-outside-repo.sh +7 -0
@@ -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
Signature · 1 line
2.50.0
PATCH v2 5/7 t/t1517: move send-pack -h test to t1517
In reply to Usman AkinyemiThe 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.
--- t/t1517-outside-repo.sh | 7 +++++++ t/t5400-send-pack.sh | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-)
t/t1517-outside-repo.sh +7 -0
@@ -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
t/t5400-send-pack.sh +0 -7
@@ -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
Signature · 1 line
2.50.0
PATCH v2 6/7 t/t1517: move verify-commit -h test to t1517
In reply to Usman AkinyemiThe 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.
--- t/t1517-outside-repo.sh | 7 +++++++ t/t7510-signed-commit.sh | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-)
t/t1517-outside-repo.sh +7 -0
@@ -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
t/t7510-signed-commit.sh +0 -7
@@ -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
Signature · 1 line
2.50.0
PATCH v2 7/7 t/t1517: move verify-tag -h test to t1517
In reply to Usman AkinyemiThe 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.
--- t/t1517-outside-repo.sh | 7 +++++++ t/t7030-verify-tag.sh | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-)
t/t1517-outside-repo.sh +7 -0
@@ -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
t/t7030-verify-tag.sh +0 -7
@@ -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 &&
Signature · 1 line
2.50.0
v2 cover move builtin help test to t1517
In reply to Usman AkinyemiIn 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.
Changes since v3:
- Fix the typo which I thought I was able to fix in v2
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(-)
Signature · 1 line
2.50.0
PATCH v3 1/7 t/t1517: move checkout-index -h test to t1517
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.
--- t/t1517-outside-repo.sh | 7 +++++++ t/t2006-checkout-index-basic.sh | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-)
t/t1517-outside-repo.sh +7 -0
@@ -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 && + 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
t/t2006-checkout-index-basic.sh +0 -7
@@ -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
Signature · 1 line
2.50.0
PATCH v3 2/7 t/t1517: move for-each-ref -h test to t1517
In reply to Usman AkinyemiThe 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.
--- t/t1517-outside-repo.sh | 7 +++++++ t/t6300-for-each-ref.sh | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-)
t/t1517-outside-repo.sh +7 -0
@@ -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
t/t6300-for-each-ref.sh +0 -7
@@ -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 &&
Signature · 1 line
2.50.0
PATCH v3 3/7 t/t1517: move ls-files -h test to t1517
In reply to Usman AkinyemiThe 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.
--- t/t1517-outside-repo.sh | 7 +++++++ t/t3004-ls-files-basic.sh | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-)
t/t1517-outside-repo.sh +7 -0
@@ -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
t/t3004-ls-files-basic.sh +0 -7
@@ -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 &&
Signature · 1 line
2.50.0
PATCH v3 4/7 t/t1517: move pack-refs -h test to t1517
In reply to Usman AkinyemiThe 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.
--- t/t0610-reftable-basics.sh | 7 ------- t/t1517-outside-repo.sh | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-)
t/t0610-reftable-basics.sh +0 -7
@@ -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 &&
t/t1517-outside-repo.sh +7 -0
@@ -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
Signature · 1 line
2.50.0
PATCH v3 5/7 t/t1517: move send-pack -h test to t1517
In reply to Usman AkinyemiThe 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.
--- t/t1517-outside-repo.sh | 7 +++++++ t/t5400-send-pack.sh | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-)
t/t1517-outside-repo.sh +7 -0
@@ -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
t/t5400-send-pack.sh +0 -7
@@ -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
Signature · 1 line
2.50.0
PATCH v3 6/7 t/t1517: move verify-commit -h test to t1517
In reply to Usman AkinyemiThe 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.
--- t/t1517-outside-repo.sh | 7 +++++++ t/t7510-signed-commit.sh | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-)
t/t1517-outside-repo.sh +7 -0
@@ -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
t/t7510-signed-commit.sh +0 -7
@@ -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
Signature · 1 line
2.50.0
Re: [PATCH v3 6/7] t/t1517: move verify-commit -h test to t1517
Quoted 8 lines · Usman Akinyemi
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.
Quoted 6 lines
Suggested-by Patrick Steinhardt <[email protected]>Signed-off-by Usman Akinyemi <[email protected]>--- t/t1517-outside-repo.sh | 7 +++++++ t/t7510-signed-commit.sh | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-)
My first reaction to this series was "heh, you can cut it both ways; a test to see how a command A works outside a repository can be a test about command A (which is the way how the current test suite looks at) or a test about being outside a repository (which this topic tries to move into).
But this may be an example that shows why it is more error prone to partition across "inside? outside?" axis. These particular ones may be limited to "should exit without crashing and without doing anything fancy when asked to give a short help", so this move may happen to be able to lose the GPG prerequisite without breaking anything.
But in the longer run, we are very much likely that we'd want to test something that needs things that require prerequisites (like "do this only where XYZ is installed") but ought to work outside a repository, which means t1517 would need to pull in things like lib-gpg.sh only because it has a few tests about verify-blah command. These tend to accumulate over time.
So, I dunno.
Re: [PATCH v3 6/7] t/t1517: move verify-commit -h test to t1517
Quoted 11 lines · Junio C Hamano
Quoted 8 lines · Usman Akinyemi
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.
Quoted 7 lines
Quoted 6 lines
Suggested-by Patrick Steinhardt <[email protected]>Signed-off-by Usman Akinyemi <[email protected]>--- t/t1517-outside-repo.sh | 7 +++++++ t/t7510-signed-commit.sh | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-)
Hi Junio,
Quoted 6 lines
My first reaction to this series was "heh, you can cut it both ways; a test to see how a command A works outside a repository can be a test about command A (which is the way how the current test suite looks at) or a test about being outside a repository (which this topic tries to move into).
Actually, I felt the same while trying to create the patch series. I was going to just send a single patch before as an RFC.
Quoted 7 lines
But this may be an example that shows why it is more error prone to partition across "inside? outside?" axis. These particular ones may be limited to "should exit without crashing and without doing anything fancy when asked to give a short help", so this move may happen to be able to lose the GPG prerequisite without breaking anything.
Quoted 6 lines
But in the longer run, we are very much likely that we'd want to test something that needs things that require prerequisites (like "do this only where XYZ is installed") but ought to work outside a repository, which means t1517 would need to pull in things like
lib-gpg.shonly because it has a few tests about verify-blah command. These tend to accumulate over time.
I understand the concern and I felt we should at least decide where to put the "verify -h" because, right now, we have some of them in the t1517 and also some in their respective test files. So, there are some little hiccups there. It will also create a headache for someone who is trying to place the test(deciding if they should put it in the t1517 as some test or inside
their respective test as some others). Also, Ayush(GSoC) is also working currently around this
part.
Is it something that is worth creating a new test file for, I will probably say that is a viable solution or better still we should put the test inside their respective test files.
What do you think ?
Quoted 3 lines
So, I dunno.
Re: [PATCH v3 6/7] t/t1517: move verify-commit -h test to t1517
Quoted 10 lines · Usman Akinyemi
Quoted 6 lines
But in the longer run, we are very much likely that we'd want to test something that needs things that require prerequisites (like "do this only where XYZ is installed") but ought to work outside a repository, which means t1517 would need to pull in things like
lib-gpg.shonly because it has a few tests about verify-blah command. These tend to accumulate over time.I understand the concern and I felt we should at least decide where to put the "verify -h" because, right now, we have some of them in the t1517 and also some in their respective test files.
If t1517 were only about "git subcmd -h outside a repository" for various subcommands, that would be a happy arrangement. I think we even have a way to iterate over all Git subcommands, current or future, so your patch may become "we've sprinkled 'subcmd -h' tests in various scripts, but now t1517 will do that automatically so anybody who add a new command do not have to do anything".
But if t1517 currently (before your series) already has other things tested, that changes the story somewhat. Especially if we aim for the automated solution, we may want to move existing tests in 1517 that is not about "subcmd -h" out to different scripts. Obvious two choices are:
- We spread them to existing test scripts for the command being tested (e.g. "does patch-id work correctly outside a repo?" moves to t4204-patch-id, and "does update-server-info work OK inside and outside a repo?" can be split and one half moves to t5200-update-server-info).
- We move them all to a new test script that is dedicated for "do various subcommands work outside a repo to do things other than responding to '-h'?".
and I would favour the former.
The only reason why you moved these to t1517 is because the set-up part of that script sets up the ceiling just once properly and let its tests do as if they are running outsie a repository, and having to arrange the ceiling correctly to add a few test in various scripts so that each of these scripts can test their single subcommand pretending that it is running outside a repository looked cumbersome, right? And I do agree with you, if that was the reason, that it is annoying to have to set up the ceiling manually in each test script. But then can we do it less annoying? We already made a nongit test helper and it may be good enough to help existing tests in t1517.
As an illustration, here is what the beginning of the former approach may look like.
t/t1517-outside-repo.sh | 27 +++++++++++++++++++++------ t/t5200-update-server-info.sh | 5 +++++ 2 files changed, 26 insertions(+), 6 deletions(-)
t/t1517-outside-repo.sh +21 -6
@@ -107,11 +107,26 @@ test_expect_success LIBCURL 'remote-http outside repository' ' test_grep "^error: remote-curl" actual ' -test_expect_success 'update-server-info does not crash with -h' ' - test_expect_code 129 git update-server-info -h >usage && - test_grep "[Uu]sage: git update-server-info " usage && - test_expect_code 129 nongit git update-server-info -h >usage && - test_grep "[Uu]sage: git update-server-info " usage -' +for cmd in $(git --list-cmds=main) +do + cmd=${cmd%.*} # strip .sh, .perl, etc. + case "$cmd" in + archimport | cvsexportcommit | cvsimport | cvsserver | daemon | \ + difftool--helper | filter-branch | fsck-objects | get-tar-commit-id | \ + http-backend | http-fetch | http-push | init-db | instaweb.sh | \ + merge-octopus | merge-one-file | merge-resolve | mergetool | \ + mktag | p4 | p4.py | pickaxe | quiltimport | remote-ftp | remote-ftps | \ + remote-http | remote-https | replay | request-pull | send-email | \ + sh-i18n--envsubst | shell | show | stage | submodule | svn | \ + upload-archive--writer | upload-pack | web--browse | whatchanged) + expect_outcome=expect_failure ;; + *) + expect_outcome=expect_success ;; + esac + test_$expect_outcome "'git $cmd -h' outside a repository" ' + test_expect_code 129 nongit git $cmd -h >usage && + test_grep "[Uu]sage: git $cmd " usage + ' +done test_done
t/t5200-update-server-info.sh +5 -0
@@ -46,4 +46,9 @@ test_expect_success 'midx does not create duplicate pack entries' ' test_must_be_empty dups ' +test_expect_success 'update-server-info does not crash with -h' ' + test_expect_code 129 git update-server-info -h >usage && + test_grep "[Uu]sage: git update-server-info " usage +' + test_done
v4 cover refactor t1517 to focus on help output outside a repository
This series refactors t1517-outside-repo.sh to focus on testing git subcmd -h outside a Git repository. It does two things:
1. Moves the existing update-server-info -h test to t5200, since it tests behavior *inside* a repo and belongs with other update-server-info tests.
2. Introduces a loop in t1517 that automatically verifies -h output for all main Git subcommands when run outside a repository, using the nongit helper and git --list-cmds=main.
This makes t1517 easier to maintain and ensures that new commands are automatically covered for this class of behavior.
Changes since v3:
- Changes the approach from having the t1517 to test both help outside and inside repo to just having inside repo.
Usman Akinyemi (2):
t/t1517: automate git subcmd -h tests outside a repository
t5200: move update-server-info -h test from t1517
t/t1517-outside-repo.sh | 28 ++++++++++++++++++++++------ t/t5200-update-server-info.sh | 5 +++++ 2 files changed, 27 insertions(+), 6 deletions(-)
Signature · 1 line
2.50.0
PATCH v4 1/2 t/t1517: automate `git subcmd -h` tests outside a repository
Replace manual -h tests with a loop over all subcommands using git --list-cmds=main. This ensures consistent coverage of -h behavior outside a repo and future-proofs the test by covering new commands automatically.
Known exceptions are skipped or marked as expected failures.
--- t/t1517-outside-repo.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)
t/t1517-outside-repo.sh +23 -2
@@ -110,8 +110,29 @@ test_expect_success LIBCURL 'remote-http outside repository' ' test_expect_success 'update-server-info does not crash with -h' ' test_expect_code 129 git update-server-info -h >usage && test_grep "[Uu]sage: git update-server-info " usage && - test_expect_code 129 nongit git update-server-info -h >usage && - test_grep "[Uu]sage: git update-server-info " usage ' +for cmd in $(git --list-cmds=main) +do + cmd=${cmd%.*} # strip .sh, .perl, etc. + case "$cmd" in + archimport | cvsexportcommit | cvsimport | cvsserver | daemon | \ + difftool--helper | filter-branch | fsck-objects | get-tar-commit-id | \ + http-backend | http-fetch | http-push | init-db | instaweb.sh | \ + merge-octopus | merge-one-file | merge-resolve | mergetool | \ + mktag | p4 | p4.py | pickaxe | quiltimport | remote-ftp | remote-ftps | \ + remote-http | remote-https | replay | request-pull | send-email | \ + sh-i18n--envsubst | shell | show | stage | submodule | svn | \ + upload-archive--writer | upload-pack | web--browse | whatchanged) + expect_outcome=expect_failure ;; + *) + expect_outcome=expect_success ;; + esac + test_$expect_outcome "'git $cmd -h' outside a repository" ' + test_expect_code 129 nongit git $cmd -h >usage && + echo "Hello" && + test_grep "[Uu]sage: git $cmd " usage + ' +done + test_done
Signature · 1 line
2.50.0
Re: [PATCH v4 1/2] t/t1517: automate `git subcmd -h` tests outside a repository
Quoted 26 lines · Usman Akinyemi
Replace manual
-htests with a loop over all subcommands usinggit --list-cmds=main. This ensures consistent coverage of-hbehavior outside a repo and future-proofs the test by covering new commands automatically.Known exceptions are skipped or marked as expected failures.
Suggested-by Patrick Steinhardt <[email protected]>Helped-by Junio C Hamano <[email protected]>Signed-off-by Usman Akinyemi <[email protected]>--- t/t1517-outside-repo.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)t/t1517-outside-repo.sh +0
-2@@ -110,8 +110,29 @@ test_expect_success LIBCURL 'remote-http outside repository' ' test_expect_success 'update-server-info does not crash with -h' ' test_expect_code 129 git update-server-info -h >usage && test_grep "[Uu]sage: git update-server-info " usage && - test_expect_code 129 nongit git update-server-info -h >usage && - test_grep "[Uu]sage: git update-server-info " usage '
t/t1517-outside-repo.sh test_expect_success LIBCURL 'remote-http outside repository' ' · line 123
Quoted 10 lines
t/t1517-outside-repo.sh +9
-0+for cmd in $(git --list-cmds=main) +do + cmd=${cmd%.*} # strip .sh, .perl, etc. + case "$cmd" in + archimport | cvsexportcommit | cvsimport | cvsserver | daemon | \ + difftool--helper | filter-branch | fsck-objects | get-tar-commit-id | \ + http-backend | http-fetch | http-push | init-db | instaweb.sh | \ + merge-octopus | merge-one-file | merge-resolve | mergetool | \ + mktag | p4 | p4.py | pickaxe | quiltimport | remote-ftp | remote-ftps | \
Hm—if we strip the suffix with ${cmd%.*}, do we need a p4.py pattern too? Actually, at first I wondered why we need to strip the suffix at all. My local Git produces only unsuffixed commands. But bin-wrappers/git produces both p4 and p4.py; request-pull and request-pull.sh; and several others. So I think stripping is probably right, just drop the .py pattern.
t/t1517-outside-repo.sh test_expect_success LIBCURL 'remote-http outside repository' ' · line 133
Quoted 10 lines
t/t1517-outside-repo.sh +10
-0+ remote-http | remote-https | replay | request-pull | send-email | \ + sh-i18n--envsubst | shell | show | stage | submodule | svn | \ + upload-archive--writer | upload-pack | web--browse | whatchanged) + expect_outcome=expect_failure ;; + *) + expect_outcome=expect_success ;; + esac + test_$expect_outcome "'git $cmd -h' outside a repository" ' + test_expect_code 129 nongit git $cmd -h >usage && + echo "Hello" &&
Woops! While basing some work on this branch, I spotted this "echo"—I assume it's leftover and didn't mean to be included here? Will drop locally for my own work.
Quoted 9 lines
t/t1517-outside-repo.sh +4
-1+ test_grep "[Uu]sage: git $cmd " usage + ' +done + test_done --2.50.0
Last thing: outside the patch context, there's a test for prune that should probably get tweaked like the update-server-info test.
Signature · 1 line
D. Ben Knoble
Re: [PATCH v4 1/2] t/t1517: automate `git subcmd -h` tests outside a repository
Quoted 9 lines
t/t1517-outside-repo.sh test_expect_success LIBCURL 'remote-http outside repository' ' · line 123
Quoted 8 lines
t/t1517-outside-repo.sh +8
-0+do + cmd=${cmd%.*} # strip .sh, .perl, etc. + case "$cmd" in + archimport | cvsexportcommit | cvsimport | cvsserver | daemon | \ + difftool--helper | filter-branch | fsck-objects | get-tar-commit-id | \ + http-backend | http-fetch | http-push | init-db | instaweb.sh | \ + merge-octopus | merge-one-file | merge-resolve | mergetool | \ + mktag | p4 | p4.py | pickaxe | quiltimport | remote-ftp | remote-ftps | \
Quoted 6 lines
Hm—if we strip the suffix with ${cmd%.*}, do we need a
p4.pypattern too? Actually, at first I wondered why we need to strip the suffix at all. My local Git produces only unsuffixed commands. But bin-wrappers/git produces both p4 andp4.py; request-pull andrequest-pull.sh; and several others. So I think stripping is probably right, just drop the .py pattern.
Noted and thanks.
Quoted 12 lines
t/t1517-outside-repo.sh test_expect_success LIBCURL 'remote-http outside repository' ' · line 133
Quoted 11 lines
t/t1517-outside-repo.sh +10
-0+ remote-http | remote-https | replay | request-pull | send-email | \ + sh-i18n--envsubst | shell | show | stage | submodule | svn | \ + upload-archive--writer | upload-pack | web--browse | whatchanged) + expect_outcome=expect_failure ;; + *) + expect_outcome=expect_success ;; + esac + test_$expect_outcome "'git $cmd -h' outside a repository" ' + test_expect_code 129 nongit git $cmd -h >usage && + echo "Hello" &&
Quoted 4 lines
Woops! While basing some work on this branch, I spotted this "echo"—I assume it's leftover and didn't mean to be included here? Will drop locally for my own work.
Since you based your work on mine, does it mean I do not have to send the updated patch ?
Re: [PATCH v4 1/2] t/t1517: automate `git subcmd -h` tests outside a repository
Quoted 11 lines · Usman Akinyemi
Quoted 11 lines
Quoted 10 lines
t/t1517-outside-repo.sh +10
-0+ remote-http | remote-https | replay | request-pull | send-email | \ + sh-i18n--envsubst | shell | show | stage | submodule | svn | \ + upload-archive--writer | upload-pack | web--browse | whatchanged) + expect_outcome=expect_failure ;; + *) + expect_outcome=expect_success ;; + esac + test_$expect_outcome "'git $cmd -h' outside a repository" ' + test_expect_code 129 nongit git $cmd -h >usage && + echo "Hello" &&
Quoted 6 lines
Quoted 4 lines
Woops! While basing some work on this branch, I spotted this "echo"—I assume it's leftover and didn't mean to be included here? Will drop locally for my own work.
Since you based your work on mine, does it mean I do not have to send the updated patch ?
That's more a question for Junio than me, but I'm comfortable rebasing my work on top of updated versions of your branch—and I would prefer to keep iterations of this series separate from my own, heh.
Really I hope you'll squash my fixes in, and possibly a few others, and send another version? For example:
- pickaxe is a failure because the message is about blame;
- show is a failure because the message is about log _and_ show;
- init-db is a failure because the message is about init;
- whatchanged is a failure because the message is about log/show. Maybe these are "out of scope," which is fine—but I think they are working as intended?
Signature · 1 line
D. Ben Knoble
Re: [PATCH v4 1/2] t/t1517: automate `git subcmd -h` tests outside a repository
In reply to D. Ben KnobleQuoted 10 lines · D. Ben Knoble
t/t1517-outside-repo.sh test_expect_success LIBCURL 'remote-http outside repository' ' · line 123
Quoted 9 lines
t/t1517-outside-repo.sh +9
-0+for cmd in $(git --list-cmds=main) +do + cmd=${cmd%.*} # strip .sh, .perl, etc. + case "$cmd" in + archimport | cvsexportcommit | cvsimport | cvsserver | daemon | \ + difftool--helper | filter-branch | fsck-objects | get-tar-commit-id | \ + http-backend | http-fetch | http-push | init-db | instaweb.sh | \ + merge-octopus | merge-one-file | merge-resolve | mergetool | \ + mktag | p4 | p4.py | pickaxe | quiltimport | remote-ftp | remote-ftps | \
Quoted 7 lines
Hm—if we strip the suffix with ${cmd%.*}, do we need a
p4.pypattern too? Actually, at first I wondered why we need to strip the suffix at all. My local Git produces only unsuffixed commands.
...
bin-wrappers/git produces both p4 andp4.py; request-pull andrequest-pull.sh; and several others. So I think stripping is probably right, just drop the .py pattern.
Ahh, OK, I didn't realize that bin-wrappers gets into the picture. So you're right. Fixing the bin-wrappers may be necessary, but dropping the extra ones is certainly a good idea.
Quoted 6 lines
t/t1517-outside-repo.sh test_expect_success LIBCURL 'remote-http outside repository' ' · line 133
Quoted 3 lines
t/t1517-outside-repo.sh +3
-0+ test_$expect_outcome "'git $cmd -h' outside a repository" ' + test_expect_code 129 nongit git $cmd -h >usage && + echo "Hello" &&Woops! While basing some work on this branch, I spotted this "echo"—I assume it's leftover and didn't mean to be included here?
;-)
Re: [PATCH v4 1/2] t/t1517: automate `git subcmd -h` tests outside a repository
In reply to D. Ben KnobleQuoted 30 lines · D. Ben Knoble
Quoted 27 lines · Usman Akinyemi
Replace manual
-htests with a loop over all subcommands usinggit --list-cmds=main. This ensures consistent coverage of-hbehavior outside a repo and future-proofs the test by covering new commands automatically.Known exceptions are skipped or marked as expected failures.
Suggested-by Patrick Steinhardt <[email protected]>Helped-by Junio C Hamano <[email protected]>Signed-off-by Usman Akinyemi <[email protected]>--- t/t1517-outside-repo.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)t/t1517-outside-repo.sh +0
-2@@ -110,8 +110,29 @@ test_expect_success LIBCURL 'remote-http outside repository' ' test_expect_success 'update-server-info does not crash with -h' ' test_expect_code 129 git update-server-info -h >usage && test_grep "[Uu]sage: git update-server-info " usage && - test_expect_code 129 nongit git update-server-info -h >usage && - test_grep "[Uu]sage: git update-server-info " usage '
Quoted 16 lines
t/t1517-outside-repo.sh test_expect_success LIBCURL 'remote-http outside repository' ' · line 123
Quoted 9 lines
t/t1517-outside-repo.sh +9
-0+for cmd in $(git --list-cmds=main) +do + cmd=${cmd%.*} # strip .sh, .perl, etc. + case "$cmd" in + archimport | cvsexportcommit | cvsimport | cvsserver | daemon | \ + difftool--helper | filter-branch | fsck-objects | get-tar-commit-id | \ + http-backend | http-fetch | http-push | init-db | instaweb.sh | \ + merge-octopus | merge-one-file | merge-resolve | mergetool | \ + mktag | p4 | p4.py | pickaxe | quiltimport | remote-ftp | remote-ftps | \Hm—if we strip the suffix with ${cmd%.*}, do we need a
p4.pypattern too? Actually, at first I wondered why we need to strip the suffix at all. My local Git produces only unsuffixed commands. But bin-wrappers/git produces both p4 andp4.py; request-pull andrequest-pull.sh; and several others. So I think stripping is probably right, just drop the .py pattern.
I think that using "instaweb.sh" instead of "instaweb" also causes this to fail on Windows, like:
https://github.com/benknoble/git/actions/runs/16695826272/job/47259908953
Signature · 1 line
D. Ben Knoble
Re: [PATCH v4 1/2] t/t1517: automate `git subcmd -h` tests outside a repository
Quoted 11 lines
Quoted 6 lines
Hm—if we strip the suffix with ${cmd%.*}, do we need a
p4.pypattern too? Actually, at first I wondered why we need to strip the suffix at all. My local Git produces only unsuffixed commands. But bin-wrappers/git produces both p4 andp4.py; request-pull andrequest-pull.sh; and several others. So I think stripping is probably right, just drop the .py pattern.I think that using "
instaweb.sh" instead of "instaweb" also causes this to fail on Windows, like:https://github.com/benknoble/git/actions/runs/16695826272/job/47259908953
I think this is expected breakage. Removing ".sh" makes the #TODO to pass.
Quoted 3 lines
--
D. Ben Knoble
Re: [PATCH v4 1/2] t/t1517: automate `git subcmd -h` tests outside a repository
In reply to Usman AkinyemiQuoted 29 lines · Usman Akinyemi
Replace manual
-htests with a loop over all subcommands usinggit --list-cmds=main. This ensures consistent coverage of-hbehavior outside a repo and future-proofs the test by covering new commands automatically.Known exceptions are skipped or marked as expected failures.
Suggested-by Patrick Steinhardt <[email protected]>Helped-by Junio C Hamano <[email protected]>Signed-off-by Usman Akinyemi <[email protected]>--- t/t1517-outside-repo.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)t/t1517-outside-repo.sh +2
-2@@ -110,8 +110,29 @@ test_expect_success LIBCURL 'remote-http outside repository' ' test_expect_success 'update-server-info does not crash with -h' ' test_expect_code 129 git update-server-info -h >usage && test_grep "[Uu]sage: git update-server-info " usage && - test_expect_code 129 nongit git update-server-info -h >usage && - test_grep "[Uu]sage: git update-server-info " usage ' +for cmd in $(git --list-cmds=main) +do
t/t1517-outside-repo.sh test_expect_success LIBCURL 'remote-http outside repository' ' · line 126
Quoted 10 lines
t/t1517-outside-repo.sh +10
-0+ cmd=${cmd%.*} # strip .sh, .perl, etc. + case "$cmd" in + archimport | cvsexportcommit | cvsimport | cvsserver | daemon | \ + difftool--helper | filter-branch | fsck-objects | get-tar-commit-id | \ + http-backend | http-fetch | http-push | init-db | instaweb.sh | \ + merge-octopus | merge-one-file | merge-resolve | mergetool | \ + mktag | p4 | p4.py | pickaxe | quiltimport | remote-ftp | remote-ftps | \ + remote-http | remote-https | replay | request-pull | send-email | \ + sh-i18n--envsubst | shell | show | stage | submodule | svn | \ + upload-archive--writer | upload-pack | web--browse | whatchanged)
Sorry, one more thing: I spot-checked a few of these, and it seems the main issue that causes failures is the exit code; they seem to work with "-h" outside a repo. Out of scope for this series, but something worth tidying up as #leftoverbits ?
Quoted 16 lines
t/t1517-outside-repo.sh +11
-1+ expect_outcome=expect_failure ;; + *) + expect_outcome=expect_success ;; + esac + test_$expect_outcome "'git $cmd -h' outside a repository" ' + test_expect_code 129 nongit git $cmd -h >usage && + echo "Hello" && + test_grep "[Uu]sage: git $cmd " usage + ' +done + test_done --2.50.0
Signature · 1 line
D. Ben Knoble
Re: [PATCH v4 1/2] t/t1517: automate `git subcmd -h` tests outside a repository
Quoted 39 lines · D. Ben Knoble
Quoted 36 lines · Usman Akinyemi
Replace manual
-htests with a loop over all subcommands usinggit --list-cmds=main. This ensures consistent coverage of-hbehavior outside a repo and future-proofs the test by covering new commands automatically.Known exceptions are skipped or marked as expected failures.
Suggested-by Patrick Steinhardt <[email protected]>Helped-by Junio C Hamano <[email protected]>Signed-off-by Usman Akinyemi <[email protected]>--- t/t1517-outside-repo.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)t/t1517-outside-repo.sh +9
-2@@ -110,8 +110,29 @@ test_expect_success LIBCURL 'remote-http outside repository' ' test_expect_success 'update-server-info does not crash with -h' ' test_expect_code 129 git update-server-info -h >usage && test_grep "[Uu]sage: git update-server-info " usage && - test_expect_code 129 nongit git update-server-info -h >usage && - test_grep "[Uu]sage: git update-server-info " usage ' +for cmd in $(git --list-cmds=main) +do + cmd=${cmd%.*} # strip .sh, .perl, etc. + case "$cmd" in + archimport | cvsexportcommit | cvsimport | cvsserver | daemon | \ + difftool--helper | filter-branch | fsck-objects | get-tar-commit-id | \ + http-backend | http-fetch | http-push | init-db | instaweb.sh | \ + merge-octopus | merge-one-file | merge-resolve | mergetool | \ + mktag | p4 | p4.py | pickaxe | quiltimport | remote-ftp | remote-ftps | \
Quoted 8 lines
t/t1517-outside-repo.sh test_expect_success LIBCURL 'remote-http outside repository' ' · line 126
Quoted 3 lines
t/t1517-outside-repo.sh +3
-0+ remote-http | remote-https | replay | request-pull | send-email | \ + sh-i18n--envsubst | shell | show | stage | submodule | svn | \ + upload-archive--writer | upload-pack | web--browse | whatchanged)Sorry, one more thing: I spot-checked a few of these, and it seems the main issue that causes failures is the exit code; they seem to work with "-h" outside a repo. Out of scope for this series, but something worth tidying up as #leftoverbits ?
It turns out a few pass for me right now: quiltimport and request-pull both work just fine.
Signature · 1 line
D. Ben Knoble
Re: [PATCH v4 1/2] t/t1517: automate `git subcmd -h` tests outside a repository
In reply to D. Ben KnobleQuoted 9 lines
Quoted 9 lines
t/t1517-outside-repo.sh +9
-0+for cmd in $(git --list-cmds=main) +do + cmd=${cmd%.*} # strip .sh, .perl, etc. + case "$cmd" in + archimport | cvsexportcommit | cvsimport | cvsserver | daemon | \ + difftool--helper | filter-branch | fsck-objects | get-tar-commit-id | \ + http-backend | http-fetch | http-push | init-db | instaweb.sh | \ + merge-octopus | merge-one-file | merge-resolve | mergetool | \ + mktag | p4 | p4.py | pickaxe | quiltimport | remote-ftp | remote-ftps | \
Quoted 9 lines
t/t1517-outside-repo.sh test_expect_success LIBCURL 'remote-http outside repository' ' · line 126
Quoted 3 lines
t/t1517-outside-repo.sh +3
-0+ remote-http | remote-https | replay | request-pull | send-email | \ + sh-i18n--envsubst | shell | show | stage | submodule | svn | \ + upload-archive--writer | upload-pack | web--browse | whatchanged)Sorry, one more thing: I spot-checked a few of these, and it seems the main issue that causes failures is the exit code; they seem to work with "-h" outside a repo. Out of scope for this series, but something worth tidying up as #leftoverbits ?
You meant the exit code of 129 right ?
Re: [PATCH v4 1/2] t/t1517: automate `git subcmd -h` tests outside a repository
Quoted 19 lines · Usman Akinyemi
Quoted 10 lines
Quoted 10 lines
t/t1517-outside-repo.sh +9
-0+for cmd in $(git --list-cmds=main) +do + cmd=${cmd%.*} # strip .sh, .perl, etc. + case "$cmd" in + archimport | cvsexportcommit | cvsimport | cvsserver | daemon | \ + difftool--helper | filter-branch | fsck-objects | get-tar-commit-id | \ + http-backend | http-fetch | http-push | init-db | instaweb.sh | \ + merge-octopus | merge-one-file | merge-resolve | mergetool | \ + mktag | p4 | p4.py | pickaxe | quiltimport | remote-ftp | remote-ftps | \Quoted 9 lines
t/t1517-outside-repo.sh test_expect_success LIBCURL 'remote-http outside repository' ' · line 126
Quoted 3 lines
t/t1517-outside-repo.sh +3
-0+ remote-http | remote-https | replay | request-pull | send-email | \ + sh-i18n--envsubst | shell | show | stage | submodule | svn | \ + upload-archive--writer | upload-pack | web--browse | whatchanged)Sorry, one more thing: I spot-checked a few of these, and it seems the main issue that causes failures is the exit code; they seem to work with "-h" outside a repo. Out of scope for this series, but something worth tidying up as #leftoverbits ?
Quoted 1 line
You meant the exit code of 129 right ?
Yep: some of our commands (often the ones implemented as scripts?) don't exit 129. Fixing that is certainly out-of-scope for this otherwise-tightly focused series.
Signature · 1 line
D. Ben Knoble
Re: [PATCH v4 1/2] t/t1517: automate `git subcmd -h` tests outside a repository
In reply to D. Ben KnobleQuoted 4 lines · D. Ben Knoble
Sorry, one more thing: I spot-checked a few of these, and it seems the main issue that causes failures is the exit code; they seem to work with "-h" outside a repo. Out of scope for this series, but something worth tidying up as #leftoverbits ?
Great suggestion. Thanks.
Re: [PATCH v4 1/2] t/t1517: automate `git subcmd -h` tests outside a repository
In reply to Usman AkinyemiHi Usman
Quoted 6 lines · Usman Akinyemi
t/t1517-outside-repo.sh +0
-0
t/t1517-outside-repo.sh test_expect_success LIBCURL 'remote-http outside repository' ' · line 115
Quoted 8 lines
t/t1517-outside-repo.sh +1
-2@@ -110,8 +110,29 @@ test_expect_success LIBCURL 'remote-http outside repository' ' test_expect_success 'update-server-info does not crash with -h' ' test_expect_code 129 git update-server-info -h >usage && test_grep "[Uu]sage: git update-server-info " usage && - test_expect_code 129 nongit git update-server-info -h >usage && - test_grep "[Uu]sage: git update-server-info " usage ' +for cmd in $(git --list-cmds=main)
This lists all the git commands in $PATH which is causing "make test" to fail when I run it locally as it is testing all my local "git-*" scripts most of which apparently fail this test. If there isn't already we should add a option that lists the commands only in $GIT_EXEC_PATH and use it here.
Also when I run the test with '-i' it does not stop at the first failure. I'm not sure what's causing that as I thought test_expect_success should exit on failure even when it is called in a loop.
Thanks
Phillip
Quoted 23 lines
t/t1517-outside-repo.sh +22
-0+do + cmd=${cmd%.*} # strip .sh, .perl, etc. + case "$cmd" in + archimport | cvsexportcommit | cvsimport | cvsserver | daemon | \ + difftool--helper | filter-branch | fsck-objects | get-tar-commit-id | \ + http-backend | http-fetch | http-push | init-db | instaweb.sh | \ + merge-octopus | merge-one-file | merge-resolve | mergetool | \ + mktag | p4 | p4.py | pickaxe | quiltimport | remote-ftp | remote-ftps | \ + remote-http | remote-https | replay | request-pull | send-email | \ + sh-i18n--envsubst | shell | show | stage | submodule | svn | \ + upload-archive--writer | upload-pack | web--browse | whatchanged) + expect_outcome=expect_failure ;; + *) + expect_outcome=expect_success ;; + esac + test_$expect_outcome "'git $cmd -h' outside a repository" ' + test_expect_code 129 nongit git $cmd -h >usage && + echo "Hello" && + test_grep "[Uu]sage: git $cmd " usage + ' +done + test_done
Re: [PATCH v4 1/2] t/t1517: automate `git subcmd -h` tests outside a repository
Quoted 17 lines · Phillip Wood
Hi Usman
Quoted 13 lines · Usman Akinyemi
t/t1517-outside-repo.sh +0
-2@@ -110,8 +110,29 @@ test_expect_success LIBCURL 'remote-http outside repository' ' test_expect_success 'update-server-info does not crash with -h' ' test_expect_code 129 git update-server-info -h >usage && test_grep "[Uu]sage: git update-server-info " usage && - test_expect_code 129 nongit git update-server-info -h >usage && - test_grep "[Uu]sage: git update-server-info " usage '
Quoted 7 lines
t/t1517-outside-repo.sh test_expect_success LIBCURL 'remote-http outside repository' ' · line 115
Quoted 1 line
t/t1517-outside-repo.sh +1
-0+for cmd in $(git --list-cmds=main)This lists all the git commands in $PATH which is causing "make test" to fail when I run it locally as it is testing all my local "git-*" scripts most of which apparently fail this test. If there isn't already we should add a option that lists the commands only in $GIT_EXEC_PATH and use it here.
That should only happen if you set GIT_TEST_INSTALLED or something, right? Or maybe some even more exotic setup: even with my distro-installed Git, the command doesn't list my git-* scripts in $PATH or installed extensions (like git-when-merged).
Quoted 3 lines
Also when I run the test with '-i' it does not stop at the first failure. I'm not sure what's causing that as I thought
test_expect_successshould exit on failure even when it is called in a loop.
That's odd: when I make some modifications that cause a failure and run with "-i," it does stop early. Hm.
Thanks for looking carefully! I'm personally having a hard time reproducing the issue though :/
Signature · 1 line
D. Ben Knoble
Re: [PATCH v4 1/2] t/t1517: automate `git subcmd -h` tests outside a repository
Hi Ben
Quoted 10 lines · D. Ben Knoble
Quoted 8 lines · Phillip Wood
Quoted 2 lines
+for cmd in $(git --list-cmds=main)
This lists all the git commands in $PATH which is causing "make test" to fail when I run it locally as it is testing all my local "git-*" scripts most of which apparently fail this test. If there isn't already we should add a option that lists the commands only in $GIT_EXEC_PATH and use it here.
Quoted 4 lines
That should only happen if you set
GIT_TEST_INSTALLEDor something, right? Or maybe some even more exotic setup: even with my distro-installed Git, the command doesn't list my git-* scripts in $PATH or installed extensions (like git-when-merged).
Sorry for the confusion, I've just had another look and it turns out I had some rubbish laying around in the root of my repository which was causing the problem.
Quoted 9 lines
Quoted 3 lines
Also when I run the test with '-i' it does not stop at the first failure. I'm not sure what's causing that as I thought
test_expect_successshould exit on failure even when it is called in a loop.That's odd: when I make some modifications that cause a failure and run with "-i," it does stop early. Hm.
Thanks for looking carefully! I'm personally having a hard time reproducing the issue though :/
Hmm, I'm not sure what was happening, at the time it looked like the loop was continuing but I can't reproduce it either now.
Thanks for taking a look and sorry for the noise
Phillip
Re: [PATCH v4 1/2] t/t1517: automate `git subcmd -h` tests outside a repository
Quoted 2 lines · Phillip Wood
Hi Ben
[snip]
Quoted 3 lines
Thanks for taking a look and sorry for the noise
Phillip
No worries, glad it worked out!
Signature · 1 line
D. Ben Knoble
Re: [PATCH v4 1/2] t/t1517: automate `git subcmd -h` tests outside a repository
In reply to Phillip WoodQuoted 8 lines · Phillip Wood
Quoted 4 lines
That should only happen if you set
GIT_TEST_INSTALLEDor something, right? Or maybe some even more exotic setup: even with my distro-installed Git, the command doesn't list my git-* scripts in $PATH or installed extensions (like git-when-merged).Sorry for the confusion, I've just had another look and it turns out I had some rubbish laying around in the root of my repository which was causing the problem.
I do not think this is something you should feel sorry about.
If you checked out and built 'seen' that invents new commands, and then checked out 'next' that lacks these new commands without first running "make clean" (relying on the mtime of the source will cause rebuilding of necessary things), your build on 'next' will see "some rubbish laying around" that may cause the same issue, no?
As "test" is primarily to help developers, I think we should find a way for this test not to be confused by "some rubbish laying around" if possible.
Thanks.
Re: [PATCH v4 1/2] t/t1517: automate `git subcmd -h` tests outside a repository
Thanks all for this.
PATCH v4 2/2 t5200: move `update-server-info -h` test from t1517
In reply to Usman Akinyemit1517 is now focused on testing subcommands outside a repository. Move the in-repo -h test for update-server-info to t5200, which covers this command.
--- t/t1517-outside-repo.sh | 5 ----- t/t5200-update-server-info.sh | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-)
t/t1517-outside-repo.sh +0 -5
@@ -107,11 +107,6 @@ test_expect_success LIBCURL 'remote-http outside repository' ' test_grep "^error: remote-curl" actual ' -test_expect_success 'update-server-info does not crash with -h' ' - test_expect_code 129 git update-server-info -h >usage && - test_grep "[Uu]sage: git update-server-info " usage && -' - for cmd in $(git --list-cmds=main) do cmd=${cmd%.*} # strip .sh, .perl, etc.
t/t5200-update-server-info.sh +5 -0
@@ -46,4 +46,9 @@ test_expect_success 'midx does not create duplicate pack entries' ' test_must_be_empty dups ' +test_expect_success 'update-server-info does not crash with -h' ' + test_expect_code 129 git update-server-info -h >usage && + test_grep "[Uu]sage: git update-server-info " usage && +' + test_done
Signature · 1 line
2.50.0
Re: [PATCH v4 2/2] t5200: move `update-server-info -h` test from t1517
Quoted 34 lines · Usman Akinyemi
t1517 is now focused on testing subcommands outside a repository. Move the in-repo
-htest forupdate-server-infoto t5200, which covers this command.Suggested-by Patrick Steinhardt <[email protected]>Helped-by Junio C Hamano <[email protected]>Signed-off-by Usman Akinyemi <[email protected]>--- t/t1517-outside-repo.sh | 5 ----- t/t5200-update-server-info.sh | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-)t/t1517-outside-repo.sh +0
-5@@ -107,11 +107,6 @@ test_expect_success LIBCURL 'remote-http outside repository' ' test_grep "^error: remote-curl" actual ' -test_expect_success 'update-server-info does not crash with -h' ' - test_expect_code 129 git update-server-info -h >usage && - test_grep "[Uu]sage: git update-server-info " usage && -' - for cmd in $(git --list-cmds=main) do cmd=${cmd%.*} # strip .sh, .perl, etc.t/t5200-update-server-info.sh +0
-0
t/t5200-update-server-info.sh test_expect_success 'midx does not create duplicate pack entries' ' · line 51
Quoted 6 lines
t/t5200-update-server-info.sh +3
-0@@ -46,4 +46,9 @@ test_expect_success 'midx does not create duplicate pack entries' ' test_must_be_empty dups ' +test_expect_success 'update-server-info does not crash with -h' ' + test_expect_code 129 git update-server-info -h >usage && + test_grep "[Uu]sage: git update-server-info " usage &&
One other fix I needed locally: in neither the preimage nor postimage should this have a trailing "&&"
Quoted 7 lines
t/t5200-update-server-info.sh +2
-1+' + test_done --2.50.0
Signature · 1 line
D. Ben Knoble
v5 cover refactor t1517 to focus on help output outside a repository
In reply to Usman AkinyemiThis series refactors t1517-outside-repo.sh to focus on testing git subcmd -h outside a Git repository. It does two things:
1. Moves the existing update-server-info -h test to t5200, since it tests behavior *inside* a repo and belongs with other update-server-info tests.
2. Introduces a loop in t1517 that automatically verifies -h output for all main Git subcommands when run outside a repository, using the nongit helper and git --list-cmds=main.
This makes t1517 easier to maintain and ensures that new commands are automatically covered for this class of behavior.
Changes since v4:
- Changes the approach from having the t1517 to test both help outside and inside repo to just having inside repo.
- Drop spurious message during test
- Fix known breakages that actually work
- Fix new t5200 by removing the trailing &&
- Move the prune -h test to t5304
Usman Akinyemi (3):
t/t1517: automate git subcmd -h tests outside a repository
t5200: move update-server-info -h test from t1517
t5304: move prune -h test from t1517
t/t1517-outside-repo.sh | 34 +++++++++++++++++++++------------- t/t5200-update-server-info.sh | 5 +++++ t/t5304-prune.sh | 5 +++++ 3 files changed, 31 insertions(+), 13 deletions(-)
Range-diff against v2:
1: 11eb3e7bfe < -: ---------- t/t1517: automate `git subcmd -h` tests outside a repository -: ---------- > 1: 75a1d540e4 t/t1517: automate `git subcmd -h` tests outside a repository 2: 5cf43192d0 ! 2: 8c028256a0 t5200: move `update-server-info -h` test from t1517
@@ t/t1517-outside-repo.sh: test_expect_success LIBCURL 'remote-http outside reposi
-test_expect_success 'update-server-info does not crash with -h' '
- test_expect_code 129 git update-server-info -h >usage &&
-- test_grep "[Uu]sage: git update-server-info " usage &&
+- test_grep "[Uu]sage: git update-server-info " usage
-'
-
+ test_expect_success 'prune does not crash with -h' '
+ test_expect_code 129 git prune -h >usage &&
+ test_grep "[Uu]sage: git prune " usage &&
+ test_expect_code 129 nongit git prune -h >usage &&
+ test_grep "[Uu]sage: git prune " usage
+ '
++
for cmd in $(git --list-cmds=main)
do
cmd=${cmd%.*} # strip .sh, .perl, etc.
@@ t/t5200-update-server-info.sh: test_expect_success 'midx does not create duplica
+test_expect_success 'update-server-info does not crash with -h' '
+ test_expect_code 129 git update-server-info -h >usage &&
-+ test_grep "[Uu]sage: git update-server-info " usage &&
++ test_grep "[Uu]sage: git update-server-info " usage
+'
+
test_done
-: ---------- > 3: c1cdbf272f t5304: move prune -h test from t1517
Signature · 1 line
2.50.1
PATCH v5 1/3 t/t1517: automate `git subcmd -h` tests outside a repository
Replace manual -h tests with a loop over all subcommands using git --list-cmds=main. This ensures consistent coverage of -h behavior outside a repo and future-proofs the test by covering new commands automatically.
Known exceptions are skipped or marked as expected failures.
--- t/t1517-outside-repo.sh | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
t/t1517-outside-repo.sh +21 -2
@@ -109,8 +109,6 @@ test_expect_success LIBCURL 'remote-http outside repository' ' test_expect_success 'update-server-info does not crash with -h' ' test_expect_code 129 git update-server-info -h >usage && - test_grep "[Uu]sage: git update-server-info " usage && - test_expect_code 129 nongit git update-server-info -h >usage && test_grep "[Uu]sage: git update-server-info " usage '
@@ -120,5 +118,26 @@ test_expect_success 'prune does not crash with -h' ' test_expect_code 129 nongit git prune -h >usage && test_grep "[Uu]sage: git prune " usage ' +for cmd in $(git --list-cmds=main) +do + cmd=${cmd%.*} # strip .sh, .perl, etc. + case "$cmd" in + archimport | cvsexportcommit | cvsimport | cvsserver | daemon | \ + difftool--helper | filter-branch | fsck-objects | get-tar-commit-id | \ + http-backend | http-fetch | http-push | init-db | \ + merge-octopus | merge-one-file | merge-resolve | mergetool | \ + mktag | p4 | p4.py | pickaxe | remote-ftp | remote-ftps | \ + remote-http | remote-https | replay | send-email | \ + sh-i18n--envsubst | shell | show | stage | submodule | svn | \ + upload-archive--writer | upload-pack | web--browse | whatchanged) + expect_outcome=expect_failure ;; + *) + expect_outcome=expect_success ;; + esac + test_$expect_outcome "'git $cmd -h' outside a repository" ' + test_expect_code 129 nongit git $cmd -h >usage && + test_grep "[Uu]sage: git $cmd " usage + ' +done test_done
Signature · 1 line
2.50.1
Re: [PATCH V5 1/3] t/t1517: automate `git subcmd -h` tests outside a repository
Quoted 30 lines · Usman Akinyemi
Replace manual
-htests with a loop over all subcommands usinggit --list-cmds=main. This ensures consistent coverage of-hbehavior outside a repo and future-proofs the test by covering new commands automatically.Known exceptions are skipped or marked as expected failures.
Suggested-by Patrick Steinhardt <[email protected]>Helped-by Junio C Hamano <[email protected]>Helped-by D. Ben Knoble <[email protected]>Signed-off-by Usman Akinyemi <[email protected]>--- t/t1517-outside-repo.sh | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)t/t1517-outside-repo.sh +0
-2@@ -109,8 +109,6 @@ test_expect_success LIBCURL 'remote-http outside repository' ' test_expect_success 'update-server-info does not crash with -h' ' test_expect_code 129 git update-server-info -h >usage && - test_grep "[Uu]sage: git update-server-info " usage && - test_expect_code 129 nongit git update-server-info -h >usage && test_grep "[Uu]sage: git update-server-info " usage '
t/t1517-outside-repo.sh test_expect_success 'prune does not crash with -h' ' · line 122
Quoted 5 lines
t/t1517-outside-repo.sh +2
-0@@ -120,5 +118,26 @@ test_expect_success 'prune does not crash with -h' ' test_expect_code 129 nongit git prune -h >usage && test_grep "[Uu]sage: git prune " usage ' +for cmd in $(git --list-cmds=main) +do
This part of the patch does not apply cleanly to v2.50.0 (the original base of the series), but I was able to apply to latest master (866e6a391f (The sixteenth batch, 2025-08-01)). It seems like the conflict was due to 7cd03a555a (builtin/prune: stop depending on 'the_repository', 2025-07-04).
All fine, just leaving a note for myself ;) I didn't see any mention of the changed base in the cover letter, so I was confused. (Rebasing onto latest master makes sense to me, but I'm not sure what the list convention is).
PS I think we want a newline after the closing quote of the prune test and before the start of the loop.
Quoted 22 lines
t/t1517-outside-repo.sh +19
-1+ cmd=${cmd%.*} # strip .sh, .perl, etc. + case "$cmd" in + archimport | cvsexportcommit | cvsimport | cvsserver | daemon | \ + difftool--helper | filter-branch | fsck-objects | get-tar-commit-id | \ + http-backend | http-fetch | http-push | init-db | \ + merge-octopus | merge-one-file | merge-resolve | mergetool | \ + mktag | p4 | p4.py | pickaxe | remote-ftp | remote-ftps | \ + remote-http | remote-https | replay | send-email | \ + sh-i18n--envsubst | shell | show | stage | submodule | svn | \ + upload-archive--writer | upload-pack | web--browse | whatchanged) + expect_outcome=expect_failure ;; + *) + expect_outcome=expect_success ;; + esac + test_$expect_outcome "'git $cmd -h' outside a repository" ' + test_expect_code 129 nongit git $cmd -h >usage && + test_grep "[Uu]sage: git $cmd " usage + ' +done test_done --
Quoted 2 lines
2.50.1
I have had to deal with yet more instaweb issues [1], which I think are because the Windows CI runs without Perl. I'm trying to come up with a fix there, but any advice welcome. (I think we just need to mark that test with the Perl pre-req, but it's interesting that this is the only command I've seen have that problem.)
Looks like Makefile:2664 is the responsible code, which I couldn't find from just looking at the instaweb script (instead had to grep the error message -> grep for use of the "unimplemented" script).
[1]: https://github.com/benknoble/git/actions/runs/16699688470/job/47268852351
--
D. Ben Knoble
Re: [PATCH V5 1/3] t/t1517: automate `git subcmd -h` tests outside a repository
Quoted 4 lines · D. Ben Knoble
All fine, just leaving a note for myself ;) I didn't see any mention of the changed base in the cover letter, so I was confused. (Rebasing onto latest master makes sense to me, but I'm not sure what the list convention is).
Once you picked a base, usually it is a good idea to keep it, unless making a trial merge of the resulting topic branch into 'master' leaves conflicts that are not trivial. And I do appreciate your noticing and mentioning that it is recommended to have a comment in the cover letter (or a comment after the three-dash line if a single patch topic) that the new iteration has been based on which commit.
Thanks.
Re: [PATCH V5 1/3] t/t1517: automate `git subcmd -h` tests outside a repository
Quoted 8 lines · Junio C Hamano
Quoted 4 lines · D. Ben Knoble
All fine, just leaving a note for myself ;) I didn't see any mention of the changed base in the cover letter, so I was confused. (Rebasing onto latest master makes sense to me, but I'm not sure what the list convention is).
Quoted 6 lines
Once you picked a base, usually it is a good idea to keep it, unless making a trial merge of the resulting topic branch into 'master' leaves conflicts that are not trivial. And I do appreciate your noticing and mentioning that it is recommended to have a comment in the cover letter (or a comment after the three-dash line if a single patch topic) that the new iteration has been based on which commit.
Thanks for this and noted.
Quoted 2 lines
Thanks.
PATCH v5 2/3 t5200: move `update-server-info -h` test from t1517
In reply to Usman Akinyemit1517 is now focused on testing subcommands outside a repository. Move the in-repo -h test for update-server-info to t5200, which covers this command.
--- t/t1517-outside-repo.sh | 6 +----- t/t5200-update-server-info.sh | 5 +++++ 2 files changed, 6 insertions(+), 5 deletions(-)
t/t1517-outside-repo.sh +1 -5
@@ -107,17 +107,13 @@ test_expect_success LIBCURL 'remote-http outside repository' ' test_grep "^error: remote-curl" actual ' -test_expect_success 'update-server-info does not crash with -h' ' - test_expect_code 129 git update-server-info -h >usage && - test_grep "[Uu]sage: git update-server-info " usage -' - test_expect_success 'prune does not crash with -h' ' test_expect_code 129 git prune -h >usage && test_grep "[Uu]sage: git prune " usage && test_expect_code 129 nongit git prune -h >usage && test_grep "[Uu]sage: git prune " usage ' + for cmd in $(git --list-cmds=main) do cmd=${cmd%.*} # strip .sh, .perl, etc.
t/t5200-update-server-info.sh +5 -0
@@ -46,4 +46,9 @@ test_expect_success 'midx does not create duplicate pack entries' ' test_must_be_empty dups ' +test_expect_success 'update-server-info does not crash with -h' ' + test_expect_code 129 git update-server-info -h >usage && + test_grep "[Uu]sage: git update-server-info " usage +' + test_done
Signature · 1 line
2.50.1
PATCH v5 3/3 t5304: move `prune -h` test from t1517
In reply to Usman Akinyemit1517 is now focused on testing subcommands outside a repository. Move the in-repo -h test for prune to t5304, which covers this command.
--- t/t1517-outside-repo.sh | 7 ------- t/t5304-prune.sh | 5 +++++ 2 files changed, 5 insertions(+), 7 deletions(-)
t/t1517-outside-repo.sh +0 -7
@@ -107,13 +107,6 @@ test_expect_success LIBCURL 'remote-http outside repository' ' test_grep "^error: remote-curl" actual ' -test_expect_success 'prune does not crash with -h' ' - test_expect_code 129 git prune -h >usage && - test_grep "[Uu]sage: git prune " usage && - test_expect_code 129 nongit git prune -h >usage && - test_grep "[Uu]sage: git prune " usage -' - for cmd in $(git --list-cmds=main) do cmd=${cmd%.*} # strip .sh, .perl, etc.
t/t5304-prune.sh +5 -0
@@ -364,4 +364,9 @@ test_expect_success 'gc.recentObjectsHook' ' git cat-file -p $BLOB ' +test_expect_success 'prune does not crash with -h' ' + test_expect_code 129 git prune -h >usage && + test_grep "[Uu]sage: git prune " usage +' + test_done
Signature · 1 line
2.50.1
v6 cover refactor t1517 to focus on help output outside a repository
In reply to Usman AkinyemiThis series refactors t1517-outside-repo.sh to focus on testing git subcmd -h outside a Git repository. It does two things:
1. Moves the existing update-server-info -h test to t5200, since it tests behavior inside a repo and belongs with other update-server-info tests.
2. Moves the existing prune -h test to t5304, since it tests behavior inside a repo and belongs with other prune tests.
3. Introduces a loop in t1517 that automatically verifies -h output for all main Git subcommands when run outside a repository, using the nongit helper and git --list-cmds=main.
This makes t1517 easier to maintain and ensures that new commands are automatically covered for this class of behavior.
Changes since v5:
- fix instaweb test using PERL prereqs (helped by Ben)
Note:
This new iteration is based on7cd03a555a (builtin/prune: stop depending on 'the_repository', 2025-07-04) commit.
Usman Akinyemi (3):
t/t1517: automate git subcmd -h tests outside a repository
t5200: move update-server-info -h test from t1517
t5304: move prune -h test from t1517
t/t1517-outside-repo.sh | 40 +++++++++++++++++++++++------------ t/t5200-update-server-info.sh | 5 +++++ t/t5304-prune.sh | 5 +++++ 3 files changed, 37 insertions(+), 13 deletions(-)
Signature · 1 line
2.50.1
PATCH v6 1/3 t/t1517: automate `git subcmd -h` tests outside a repository
Replace manual -h tests with a loop over all subcommands using git --list-cmds=main. This ensures consistent coverage of -h behavior outside a repo and future-proofs the test by covering new commands automatically.
Known exceptions are skipped or marked as expected failures.
--- t/t1517-outside-repo.sh | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-)
t/t1517-outside-repo.sh +28 -2
@@ -109,8 +109,6 @@ test_expect_success LIBCURL 'remote-http outside repository' ' test_expect_success 'update-server-info does not crash with -h' ' test_expect_code 129 git update-server-info -h >usage && - test_grep "[Uu]sage: git update-server-info " usage && - test_expect_code 129 nongit git update-server-info -h >usage && test_grep "[Uu]sage: git update-server-info " usage '
@@ -121,4 +119,32 @@ test_expect_success 'prune does not crash with -h' ' test_grep "[Uu]sage: git prune " usage ' +for cmd in $(git --list-cmds=main) +do + cmd=${cmd%.*} # strip .sh, .perl, etc. + case "$cmd" in + archimport | cvsexportcommit | cvsimport | cvsserver | daemon | \ + difftool--helper | filter-branch | fsck-objects | get-tar-commit-id | \ + http-backend | http-fetch | http-push | init-db | \ + merge-octopus | merge-one-file | merge-resolve | mergetool | \ + mktag | p4 | p4.py | pickaxe | remote-ftp | remote-ftps | \ + remote-http | remote-https | replay | send-email | \ + sh-i18n--envsubst | shell | show | stage | submodule | svn | \ + upload-archive--writer | upload-pack | web--browse | whatchanged) + expect_outcome=expect_failure ;; + *) + expect_outcome=expect_success ;; + esac + case "$cmd" in + instaweb) + prereq=PERL ;; + *) + prereq= ;; + esac + test_$expect_outcome $prereq "'git $cmd -h' outside a repository" ' + test_expect_code 129 nongit git $cmd -h >usage && + test_grep "[Uu]sage: git $cmd " usage + ' +done + test_done
Signature · 1 line
2.50.1
PATCH v6 2/3 t5200: move `update-server-info -h` test from t1517
In reply to Usman Akinyemit1517 is now focused on testing subcommands outside a repository. Move the in-repo -h test for update-server-info to t5200, which covers this command.
--- t/t1517-outside-repo.sh | 5 ----- t/t5200-update-server-info.sh | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-)
t/t1517-outside-repo.sh +0 -5
@@ -107,11 +107,6 @@ test_expect_success LIBCURL 'remote-http outside repository' ' test_grep "^error: remote-curl" actual ' -test_expect_success 'update-server-info does not crash with -h' ' - test_expect_code 129 git update-server-info -h >usage && - test_grep "[Uu]sage: git update-server-info " usage -' - test_expect_success 'prune does not crash with -h' ' test_expect_code 129 git prune -h >usage && test_grep "[Uu]sage: git prune " usage &&
t/t5200-update-server-info.sh +5 -0
@@ -46,4 +46,9 @@ test_expect_success 'midx does not create duplicate pack entries' ' test_must_be_empty dups ' +test_expect_success 'update-server-info does not crash with -h' ' + test_expect_code 129 git update-server-info -h >usage && + test_grep "[Uu]sage: git update-server-info " usage +' + test_done
Signature · 1 line
2.50.1
PATCH v6 3/3 t5304: move `prune -h` test from t1517
In reply to Usman Akinyemit1517 is now focused on testing subcommands outside a repository. Move the in-repo -h test for prune to t5304, which covers this command.
--- t/t1517-outside-repo.sh | 7 ------- t/t5304-prune.sh | 5 +++++ 2 files changed, 5 insertions(+), 7 deletions(-)
t/t1517-outside-repo.sh +0 -7
@@ -107,13 +107,6 @@ test_expect_success LIBCURL 'remote-http outside repository' ' test_grep "^error: remote-curl" actual ' -test_expect_success 'prune does not crash with -h' ' - test_expect_code 129 git prune -h >usage && - test_grep "[Uu]sage: git prune " usage && - test_expect_code 129 nongit git prune -h >usage && - test_grep "[Uu]sage: git prune " usage -' - for cmd in $(git --list-cmds=main) do cmd=${cmd%.*} # strip .sh, .perl, etc.
t/t5304-prune.sh +5 -0
@@ -364,4 +364,9 @@ test_expect_success 'gc.recentObjectsHook' ' git cat-file -p $BLOB ' +test_expect_success 'prune does not crash with -h' ' + test_expect_code 129 git prune -h >usage && + test_grep "[Uu]sage: git prune " usage +' + test_done
Signature · 1 line
2.50.1
Re: [PATCH v6 0/3] refactor t1517 to focus on help output outside a repository
In reply to Usman AkinyemiQuoted 2 lines · Usman Akinyemi
This series refactors
t1517-outside-repo.shto focus on testinggit subcmd -houtside a Git repository. It does two things:
Thanks, Usman and Ben. This iteration looks perfect. Let's mark it for 'next'.
Re: [PATCH v6 0/3] refactor t1517 to focus on help output outside a repository
Quoted 9 lines · Junio C Hamano
Quoted 2 lines · Usman Akinyemi
This series refactors
t1517-outside-repo.shto focus on testinggit subcmd -houtside a Git repository. It does two things:Thanks, Usman and Ben. This iteration looks perfect. Let's mark it for 'next'.
Excellent! In the recent "cooking" mail it looks like my series was recreated atop this one, so I won't send another version just to drop the fixup patch unless there are other comments to address.
Signature · 1 line
D. Ben Knoble
PATCH v3 7/7 t/t1517: move verify-tag -h test to t1517
In reply to Usman AkinyemiThe 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.
--- t/t1517-outside-repo.sh | 7 +++++++ t/t7030-verify-tag.sh | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-)
t/t1517-outside-repo.sh +7 -0
@@ -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
t/t7030-verify-tag.sh +0 -7
@@ -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 &&
Signature · 1 line
2.50.0