git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH v3 7/7] git-sh-setup: don't mark trees not used in-tree for i18n
Date: Sat, 26 Mar 2022 18:14:19 +0100	[thread overview]
Message-ID: <patch-v3-7.7-7a82b1fd005-20220326T171200Z-avarab@gmail.com> (raw)
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


  parent reply	other threads:[~2022-03-26 17:14 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19 12:46 [PATCH 0/6] various: remove dead code Ævar Arnfjörð Bjarmason
2021-11-19 12:46 ` [PATCH 1/6] xdiff/xmacros.h: remove unused XDL_PTRFREE Ævar Arnfjörð Bjarmason
2021-11-19 14:32   ` Jeff King
2021-11-19 12:46 ` [PATCH 2/6] pack-bitmap-write: remove unused bitmap_reset() function Ævar Arnfjörð Bjarmason
2021-11-19 14:33   ` Jeff King
2021-11-19 12:46 ` [PATCH 3/6] object-store.h: remove unused has_sha1_file*() Ævar Arnfjörð Bjarmason
2021-11-19 14:34   ` Jeff King
2021-11-19 12:46 ` [PATCH 4/6] alloc.[ch]: remove alloc_report() function Ævar Arnfjörð Bjarmason
2021-11-19 19:42   ` Junio C Hamano
2021-11-19 12:46 ` [PATCH 5/6] strbuf: remove unused istarts_with() function Ævar Arnfjörð Bjarmason
2021-11-19 14:40   ` Jeff King
2021-11-19 19:14   ` Junio C Hamano
2021-11-19 12:46 ` [PATCH 6/6] json-writer.[ch]: remove unused formatting functions Ævar Arnfjörð Bjarmason
2021-11-19 14:41   ` Jeff King
2021-11-19 21:53     ` Junio C Hamano
2021-11-19 14:42 ` [PATCH 0/6] various: remove dead code Jeff King
2021-11-19 20:26 ` [PATCH v2 0/5] " Ævar Arnfjörð Bjarmason
2021-11-19 20:26   ` [PATCH v2 1/5] xdiff/xmacros.h: remove unused XDL_PTRFREE Ævar Arnfjörð Bjarmason
2021-11-19 20:26   ` [PATCH v2 2/5] pack-bitmap-write: remove unused bitmap_reset() function Ævar Arnfjörð Bjarmason
2021-11-19 20:26   ` [PATCH v2 3/5] object-store.h: remove unused has_sha1_file*() Ævar Arnfjörð Bjarmason
2021-11-19 20:26   ` [PATCH v2 4/5] alloc.[ch]: remove alloc_report() function Ævar Arnfjörð Bjarmason
2021-11-19 20:26   ` [PATCH v2 5/5] json-writer.[ch]: remove unused formatting functions Ævar Arnfjörð Bjarmason
2022-03-26 17:14   ` [PATCH v3 0/7] various: remove dead code, drop i18n not used in-tree Ævar Arnfjörð Bjarmason
2022-03-26 17:14     ` [PATCH v3 1/7] run-command.h: remove always unused "clean_on_exit_handler_cbdata" Ævar Arnfjörð Bjarmason
2022-03-26 17:14     ` [PATCH v3 2/7] configure.ac: remove USE_PIC comment Ævar Arnfjörð Bjarmason
2022-03-26 17:14     ` [PATCH v3 3/7] xdiff/xmacros.h: remove unused XDL_PTRFREE Ævar Arnfjörð Bjarmason
2022-03-26 17:14     ` [PATCH v3 4/7] pack-bitmap-write: remove unused bitmap_reset() function Ævar Arnfjörð Bjarmason
2022-03-26 17:14     ` [PATCH v3 5/7] object-store.h: remove unused has_sha1_file*() Ævar Arnfjörð Bjarmason
2022-03-26 17:14     ` [PATCH v3 6/7] alloc.[ch]: remove alloc_report() function Ævar Arnfjörð Bjarmason
2022-03-26 17:14     ` Ævar Arnfjörð Bjarmason [this message]
2022-03-27 10:47       ` [PATCH v3 7/7] git-sh-setup: don't mark trees not used in-tree for i18n Johannes Sixt
2022-03-27 11:15         ` Ævar Arnfjörð Bjarmason
2022-03-28  6:04           ` Johannes Sixt
2022-03-28 12:16             ` Ævar Arnfjörð Bjarmason
2022-03-28 20:06               ` Johannes Sixt
2022-03-31 10:23               ` Phillip Wood
2022-03-31 11:15                 ` Ævar Arnfjörð Bjarmason
2022-03-31 20:27                   ` Johannes Sixt
2022-04-02 10:44                     ` Ævar Arnfjörð Bjarmason
2022-04-02 14:16                       ` Johannes Sixt
2022-04-03 15:22                         ` Ævar Arnfjörð Bjarmason
2022-04-04 20:20                           ` Johannes Sixt
2022-03-31  1:45     ` [PATCH v4 0/6] various: remove dead code Ævar Arnfjörð Bjarmason
2022-03-31  1:45       ` [PATCH v4 1/6] run-command.h: remove always unused "clean_on_exit_handler_cbdata" Ævar Arnfjörð Bjarmason
2022-03-31 22:03         ` Junio C Hamano
2022-03-31  1:45       ` [PATCH v4 2/6] configure.ac: remove USE_PIC comment Ævar Arnfjörð Bjarmason
2022-03-31  1:45       ` [PATCH v4 3/6] xdiff/xmacros.h: remove unused XDL_PTRFREE Ævar Arnfjörð Bjarmason
2022-03-31  1:45       ` [PATCH v4 4/6] pack-bitmap-write: remove unused bitmap_reset() function Ævar Arnfjörð Bjarmason
2022-03-31 22:06         ` Junio C Hamano
2022-03-31  1:45       ` [PATCH v4 5/6] object-store.h: remove unused has_sha1_file*() Ævar Arnfjörð Bjarmason
2022-03-31  1:45       ` [PATCH v4 6/6] alloc.[ch]: remove alloc_report() function Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=patch-v3-7.7-7a82b1fd005-20220326T171200Z-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).