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

[PATCH 2/3] add: mark --chmod error string for translation

From
Matheus Tavares <matheus.bernardino@usp.br>
Date
Feb 23, 2021, 01:10 UTC
Message-ID
<b65d3a1c3771617caea175830409a103f45e9c73.1614037664.git.matheus.bernardino@usp.br>
In-Reply-To
<cover.1614037664.git.matheus.bernardino@usp.br>

This error message is intended for humans, so mark it for translation. Also use error() instead of fprintf(stderr, ...), to make the corresponding line a bit cleaner, and to display the "error:" prefix, which helps classifying the nature/severity of the message.

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
---
 builtin/add.c  | 2 +-
 t/t3700-add.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/add.c b/builtin/add.c
index 1e33ab81f2..0c5f53c0bb 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -55,7 +55,7 @@ static void chmod_pathspec(struct pathspec *pathspec, char flip, int show_only)
 			err = S_ISREG(ce->ce_mode) ? 0 : -1;
 
 		if (err < 0)
-			fprintf(stderr, "cannot chmod %cx '%s'\n", flip, ce->name);
+			error(_("cannot chmod %cx '%s'"), flip, ce->name);
 	}
 }
 
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index fc81f2ef00..6a8b94a4f7 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -398,7 +398,7 @@ test_expect_success 'git add --chmod --dry-run reports error for non regular fil
 	git reset --hard &&
 	test_ln_s_add foo foo4 &&
 	git add --chmod=+x --dry-run foo4 2>stderr &&
-	grep "cannot chmod +x .foo4." stderr
+	test_i18ngrep "cannot chmod +x .foo4." stderr
 '
 
 test_expect_success 'git add --chmod --dry-run reports error for unmatched pathspec' '
-- 
2.30.1
Previous: Matheus TavaresNext: Matheus Tavares
Message 3 of 6 in “add: minor --chmod fixes”
  1. 0/3 add: minor --chmod fixesMatheus Tavares, Feb 23, 2021
  2. 1/3 add --chmod: don't update index when --dry-run is usedMatheus Tavares, Feb 23, 2021
  3. 2/3 add: mark --chmod error string for translationMatheus Tavares, Feb 23, 2021
  4. 3/3 add: propagate --chmod errors to exit statusMatheus Tavares, Feb 23, 2021
  5. Taylor BlauFeb 23, 2021
  6. Junio C HamanoFeb 23, 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.