[PATCH v3 7/7] git-sh-setup: don't mark trees not used in-tree for i18n
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Mar 26, 2022, 17:14 UTC
- Message-ID
- <patch-v3-7.7-7a82b1fd005-20220326T171200Z-avarab@gmail.com>
- In-Reply-To
- <cover-v3-0.7-00000000000-20220326T171200Z-avarab@gmail.com>
Partially revert d323c6b6410 (i18n: git-sh-setup.sh: mark strings for translation, 2016-06-17).
These strings are no longer used in-tree, and we shouldn't be wasting translator time on them for the benefit of a hypothetical out-of-tree user of git-sh-setup.sh.
Since d03ebd411c6 (rebase: remove the rebase.useBuiltin setting, 2019-03-18) we've had no in-tree user of require_work_tree_exists(), and since the more recent c1e10b2dce2 (git-sh-setup: remove messaging supporting --preserve-merges, 2021-10-21) the only in-tree user of require_clean_work_tree() is git-filter-branch.sh. Let's only translate the message it uses, and revert the others to the pre-image of d323c6b6410.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- git-sh-setup.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/git-sh-setup.sh b/git-sh-setup.sh index d92df37e992..1abceaac8d3 100644 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -187,8 +187,7 @@ cd_to_toplevel () { require_work_tree_exists () { if test "z$(git rev-parse --is-bare-repository)" != zfalse then - program_name=$0 - die "$(eval_gettext "fatal: \$program_name cannot be used without a working tree.")" + die "fatal: $0 cannot be used without a working tree." fi } @@ -206,13 +205,13 @@ require_clean_work_tree () { if ! git diff-files --quiet --ignore-submodules then - action=$1 - case "$action" in + case "$1" in "rewrite branches") gettextln "Cannot rewrite branches: You have unstaged changes." >&2 ;; *) - eval_gettextln "Cannot \$action: You have unstaged changes." >&2 + # Some out-of-tree user of require_clean_work_tree() + echo "Cannot $1: You have unstaged changes." >&2 ;; esac err=1 @@ -222,8 +221,15 @@ require_clean_work_tree () { then if test $err = 0 then - action=$1 - eval_gettextln "Cannot \$action: Your index contains uncommitted changes." >&2 + case "$1" in + "rewrite branches") + gettextln "Cannot rewrite branches: You have unstaged changes." >&2 + ;; + *) + # Some out-of-tree user of require_clean_work_tree() + echo "Cannot $1: Your index contains uncommitted changes." >&2 + ;; + esac else gettextln "Additionally, your index contains uncommitted changes." >&2 fi
-- 2.35.1.1535.gf8d72b9da1e