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

[PATCH 1/2] request-pull: simplify "remote or HEAD" variable in warning messages

From
Bagas Sanjaya <bagasdotme@gmail.com>
Date
Sep 16, 2021, 11:35 UTC
Message-ID
<20210916113516.76445-2-bagasdotme@gmail.com>
In-Reply-To
<20210916113516.76445-1-bagasdotme@gmail.com>

In order for waring message "Are you sure you pushed 'remote or HEAD' there?" to be translatable, replace ${remote:-HEAD} (variable access with defaults) in the message by referring it as $remote_or_head.

Cc: Ryan Anderson <ryan@michonline.com>
Cc: pbonzini@redhat.com
Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
---
 git-request-pull.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 2d0e44656c..9e1d2be9eb 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -116,15 +116,17 @@ set fnord $(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "${remote:-H
 remote_sha1=$2
 ref=$3
 
+remote_or_head=${remote:-HEAD}
+
 if test -z "$ref"
 then
 	echo "warn: No match for commit $headrev found at $url" >&2
-	echo "warn: Are you sure you pushed '${remote:-HEAD}' there?" >&2
+	echo "warn: Are you sure you pushed '$remote_or_head' there?" >&2
 	status=1
 elif test "$local_sha1" != "$remote_sha1"
 then
 	echo "warn: $head found at $url but points to a different object" >&2
-	echo "warn: Are you sure you pushed '${remote:-HEAD}' there?" >&2
+	echo "warn: Are you sure you pushed '$remote_or_head' there?" >&2
 	status=1
 fi
 
-- 
2.25.1
Previous: Bagas SanjayaNext: Paolo Bonzini
Message 2 of 10 in “git-request-pull i18n”
  1. 0/2 git-request-pull i18nBagas Sanjaya, Sep 16, 2021
  2. 1/2 request-pull: simplify "remote or HEAD" variable in warning messagesBagas Sanjaya, Sep 16, 2021
  3. Paolo BonziniSep 16, 2021
  4. 2/2 request-pull: mark translatable stringsBagas Sanjaya, Sep 16, 2021
  5. Ævar Arnfjörð BjarmasonSep 16, 2021
  6. Đoàn Trần Công DanhSep 16, 2021
  7. Junio C HamanoSep 16, 2021
  8. Bagas SanjayaSep 17, 2021
  9. Junio C HamanoSep 17, 2021
  10. Miklos VajnaSep 17, 2021

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.