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.