git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matheus Tavares <matheus.bernardino@usp.br>
To: git@vger.kernel.org
Cc: gitster@pobox.com, newren@gmail.com
Subject: [PATCH 2/3] add: mark --chmod error string for translation
Date: Mon, 22 Feb 2021 22:10:34 -0300	[thread overview]
Message-ID: <b65d3a1c3771617caea175830409a103f45e9c73.1614037664.git.matheus.bernardino@usp.br> (raw)
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


  parent reply	other threads:[~2021-02-23  1:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23  1:10 [PATCH 0/3] add: minor --chmod fixes Matheus Tavares
2021-02-23  1:10 ` [PATCH 1/3] add --chmod: don't update index when --dry-run is used Matheus Tavares
2021-02-23  1:10 ` Matheus Tavares [this message]
2021-02-23  1:10 ` [PATCH 3/3] add: propagate --chmod errors to exit status Matheus Tavares
2021-02-23 17:08 ` [PATCH 0/3] add: minor --chmod fixes Taylor Blau
2021-02-23 18:15   ` Junio C Hamano

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=b65d3a1c3771617caea175830409a103f45e9c73.1614037664.git.matheus.bernardino@usp.br \
    --to=matheus.bernardino@usp.br \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.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).