Re: [PATCH 4/9] subtree: prefix die messages with 'fatal'
From: Philippe Blain <hidden>
Date: 2022-10-26 21:25:06
Le 2022-10-21 à 12:30, Ævar Arnfjörð Bjarmason a écrit :
On Fri, Oct 21 2022, Philippe Blain via GitGitGadget wrote:quoted
From: Philippe Blain <redacted> 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" }quoted
- die "assertion failed: $*" + die "fatal: assertion failed: $*"Then you could just leave this, but...quoted
- die "Unknown command '$arg_command'" + die "fatal: unknown command '$arg_command'"...would still need to change these for the capitalization change.
Yeah, I guess to this could be done in a later refactor if someone wishes. It would probably require changes to other tests scripts (since there are other users of 'die'), though, and so would widen the scope of the series a bit too much, I would say.