[PATCH v3 2/7] t/t1517: move for-each-ref -h test to t1517
- From
Usman Akinyemi <usmanakinyemi202@gmail.com>
- Date
- Jul 6, 2025, 21:50 UTC
- Message-ID
- <20250706215039.715732-3-usmanakinyemi202@gmail.com>
- In-Reply-To
- <20250706215039.715732-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 9e54214725..d3487acbfc 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