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

Re: [PATCH 4/9] subtree: prefix die messages with 'fatal'

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Oct 21, 2022, 16:30 UTC
Message-ID
<221021.86r0z1dtjq.gmgdl@evledraar.gmail.com>
In-Reply-To
<a70fda5582d6bd84b8bedaba33768d3886846090.1666365220.git.gitgitgadget@gmail.com>
On Fri, Oct 21 2022, Philippe Blain via GitGitGadget wrote:
Show 7 quoted lines
> From: Philippe Blain <levraiphilippeblain@gmail.com>
>
> Just as was done in 0008d12284 (submodule: prefix die messages with
> 'fatal', 2021-07-10) for 'git-submodule.sh', make the 'die' messages
> outputed by 'git-subtree.sh' more in line with the rest of the code base
> by prefixing them with "fatal: ", and do not capitalize their first
> letter.

I don't really care since we're unlikely to ever give git-subtree the i18n treatment, so translators don't need to worry about the churn.

But given how few in-tree-users we have of "die" and "git-sh-setup" this
would be much shorter & future-proof as just e.g. (untested):
	
	diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
	index 7562a395c24..0d8f87c5a20 100755
	--- a/contrib/subtree/git-subtree.sh
	+++ b/contrib/subtree/git-subtree.sh
	@@ -25,6 +25,8 @@ then
	 	exit 126
	 fi
	 
	+GIT_SH_SETUP_DIE_PREFIX='fatal: '
	+
	 OPTS_SPEC="\
	 git subtree add   --prefix=<prefix> <commit>
	 git subtree add   --prefix=<prefix> <repository> <ref>
	diff --git a/git-sh-setup.sh b/git-sh-setup.sh
	index ce273fe0e48..81456d7266e 100644
	--- a/git-sh-setup.sh
	+++ b/git-sh-setup.sh
	@@ -53,7 +53,7 @@ die () {
	 die_with_status () {
	 	status=$1
	 	shift
	-	printf >&2 '%s\n' "$*"
	+	printf >&2 '%s%s\n' "$GIT_SH_SETUP_DIE_PREFIX" "$*"
	 	exit "$status"
	 }
	 
> -		die "assertion failed: $*"
> +		die "fatal: assertion failed: $*"
Then you could just leave this, but...
> -		die "Unknown command '$arg_command'"
> +		die "fatal: unknown command '$arg_command'"
...would still need to change these for the capitalization change.
Previous: Philippe Blain via GitGitGadgetNext: Philippe Blain
Message 12 of 20 in “subtree: fix split and merge after annotated tag was squash-merged”
  1. 0/9 subtree: fix split and merge after annotated tag was squash-mergedPhilippe Blain via GitGitGadget, Oct 21, 2022
  2. 3/9 subtree: add 'die_incompatible_opt' function to reduce duplicationPhilippe Blain via GitGitGadget, Oct 21, 2022
  3. Ævar Arnfjörð BjarmasonOct 21, 2022
  4. Philippe BlainOct 26, 2022
  5. 1/9 test-lib-functions: mark 'test_commit' variables as 'local'Philippe Blain via GitGitGadget, Oct 21, 2022
  6. Junio C HamanoOct 21, 2022
  7. Philippe BlainOct 26, 2022
  8. Junio C HamanoOct 26, 2022
  9. 5/9 subtree: define a variable before its first use in 'find_latest_squash'Philippe Blain via GitGitGadget, Oct 21, 2022
  10. 2/9 subtree: use 'git rev-parse --verify [--quiet]' for better error messagesPhilippe Blain via GitGitGadget, Oct 21, 2022
  11. 4/9 subtree: prefix die messages with 'fatal'Philippe Blain via GitGitGadget, Oct 21, 2022
  12. Ævar Arnfjörð BjarmasonOct 21, 2022
  13. Philippe BlainOct 26, 2022
  14. 7/9 subtree: process 'git-subtree-split' trailer in separate functionPhilippe Blain via GitGitGadget, Oct 21, 2022
  15. 9/9 subtree: fix split after annotated tag was squashed mergedPhilippe Blain via GitGitGadget, Oct 21, 2022
  16. Ævar Arnfjörð BjarmasonOct 21, 2022
  17. Eric SunshineOct 21, 2022
  18. Philippe BlainOct 26, 2022
  19. 8/9 subtree: fix squash merging after annotated tag was squashed mergedPhilippe Blain via GitGitGadget, Oct 21, 2022
  20. 6/9 subtree: use named variables instead of "$@" in cmd_pullPhilippe Blain via GitGitGadget, Oct 21, 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.