git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] t0012: verify that built-ins handle `-h` even without gitdir

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Feb 7, 2022, 23:49 UTC
Message-ID
<49977ff9f4e5616689eecc388e53cd6312454da7.1644277797.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1139.git.1644277797.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>

We just fixed a class of recently introduced bugs where calling, say, `git fetch -h` outside a repository would not show the usage but instead show an ugly `BUG` message.

Let's verify that this does not regress anymore.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t0012-help.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/t/t0012-help.sh b/t/t0012-help.sh
index 91b68c74a15..cbd725ccac8 100755
--- a/t/t0012-help.sh
+++ b/t/t0012-help.sh
@@ -139,13 +139,18 @@ test_expect_success 'git help --config-sections-for-completion' '
 '
 
 test_expect_success 'generate builtin list' '
+	mkdir -p sub &&
 	git --list-cmds=builtins >builtins
 '
 
 while read builtin
 do
 	test_expect_success "$builtin can handle -h" '
-		test_expect_code 129 git $builtin -h >output 2>&1 &&
+		(
+			GIT_CEILING_DIRECTORIES=$(pwd) &&
+			export GIT_CEILING_DIRECTORIES &&
+			test_expect_code 129 git -C sub $builtin -h >output 2>&1
+		) &&
 		test_i18ngrep usage output
 	'
 done <builtins
-- 
gitgitgadget
Previous: Johannes Schindelin via GitGitGadgetNext: Johannes Schindelin via GitGitGadget
Message 2 of 8 in “checkout/fetch/pull/pack-objects: allow -h outside a repository again”
  1. 0/2 checkout/fetch/pull/pack-objects: allow -h outside a repository againJohannes Schindelin via GitGitGadget, Feb 7, 2022
  2. 2/2 t0012: verify that built-ins handle `-h` even without gitdirJohannes Schindelin via GitGitGadget, Feb 7, 2022
  3. 1/2 checkout/fetch/pull/pack-objects: allow `-h` outside a repositoryJohannes Schindelin via GitGitGadget, Feb 7, 2022
  4. Junio C HamanoFeb 8, 2022
  5. Johannes SchindelinFeb 8, 2022
  6. 0/2 checkout/fetch/pull/pack-objects: allow -h outside a repository againJohannes Schindelin via GitGitGadget, Feb 8, 2022
  7. 2/2 t0012: verify that built-ins handle `-h` even without gitdirJohannes Schindelin via GitGitGadget, Feb 8, 2022
  8. 1/2 checkout/fetch/pull/pack-objects: allow `-h` outside a repositoryJohannes Schindelin via GitGitGadget, Feb 8, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.