add: mark --chmod error string for translation
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> Reviewed-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Matheus Tavares committed
Feb 22, 2021 at 22:10 UTC
48960894f5a89639809bdad5618439ba59869522
2 files changed
+2
-2
builtin/add.c
+1
-1
@@ -55,7 +55,7 @@ static void chmod_pathspec(struct pathspec *pathspec, char flip, int show_only)
55
err = S_ISREG(ce->ce_mode) ? 0 : -1;
56
57
if (err < 0)
58
- fprintf(stderr, "cannot chmod %cx '%s'\n", flip, ce->name);
58
+ error(_("cannot chmod %cx '%s'"), flip, ce->name);
59
}
60
}
61
t/t3700-add.sh
+1
-1
@@ -398,7 +398,7 @@ test_expect_success 'git add --chmod --dry-run reports error for non regular fil
398
git reset --hard &&
399
test_ln_s_add foo foo4 &&
400
git add --chmod=+x --dry-run foo4 2>stderr &&
401
- grep "cannot chmod +x .foo4." stderr
401
+ test_i18ngrep "cannot chmod +x .foo4." stderr
402
'
403
404
test_expect_success 'git add --chmod --dry-run reports error for unmatched pathspec' '