From: Ævar Arnfjörð Bjarmason Date: Tue, 22 Feb 2011 23:41:30 +0000 (+0000) Subject: i18n: git-add "The following paths are ignored" message X-Git-Tag: v1.7.5-rc1~19^2~62 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=439fb8296d0a08c09653a45c0f44757c6b9c99b2;p=git.git i18n: git-add "The following paths are ignored" message The tests t2204 (.gitignore) and t3700 (add) explicitly check for these messages, so while at it, split each relevant test into a part that just checks "git add"'s exit status and a part that checks porcelain output. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- diff --git a/builtin/add.c b/builtin/add.c index a9a78f4bd..21776ac52 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -307,7 +307,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix) static struct lock_file lock_file; static const char ignore_error[] = -"The following paths are ignored by one of your .gitignore files:\n"; +N_("The following paths are ignored by one of your .gitignore files:\n"); static int verbose = 0, show_only = 0, ignored_too = 0, refresh_only = 0; static int ignore_add_errors, addremove, intent_to_add, ignore_missing = 0; @@ -344,11 +344,11 @@ static int add_files(struct dir_struct *dir, int flags) int i, exit_status = 0; if (dir->ignored_nr) { - fprintf(stderr, ignore_error); + fprintf(stderr, _(ignore_error)); for (i = 0; i < dir->ignored_nr; i++) fprintf(stderr, "%s\n", dir->ignored[i]->name); - fprintf(stderr, "Use -f if you really want to add them.\n"); - die("no files added"); + fprintf(stderr, _("Use -f if you really want to add them.\n")); + die(_("no files added")); } for (i = 0; i < dir->nr; i++) diff --git a/t/t2204-add-ignored.sh b/t/t2204-add-ignored.sh index 24afdabab..49753362f 100755 --- a/t/t2204-add-ignored.sh +++ b/t/t2204-add-ignored.sh @@ -31,18 +31,21 @@ do rm -f .git/index && test_must_fail git add "$i" 2>err && git ls-files "$i" >out && - ! test -s out && - grep -e "Use -f if" err && - cat err + ! test -s out + ' + + test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i output" ' + grep -e "Use -f if" err ' test_expect_success "complaints for ignored $i with unignored file" ' rm -f .git/index && test_must_fail git add "$i" file 2>err && git ls-files "$i" >out && - ! test -s out && - grep -e "Use -f if" err && - cat err + ! test -s out + ' + test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i with unignored file output" ' + grep -e "Use -f if" err ' done @@ -54,9 +57,14 @@ do cd dir && test_must_fail git add "$i" 2>err && git ls-files "$i" >out && - ! test -s out && - grep -e "Use -f if" err && - cat err + ! test -s out + ) + ' + + test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i in dir output" ' + ( + cd dir && + grep -e "Use -f if" err ) ' done @@ -69,9 +77,14 @@ do cd sub && test_must_fail git add "$i" 2>err && git ls-files "$i" >out && - ! test -s out && - grep -e "Use -f if" err && - cat err + ! test -s out + ) + ' + + test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i in sub output" ' + ( + cd sub && + grep -e "Use -f if" err ) ' done diff --git a/t/t3700-add.sh b/t/t3700-add.sh index ec7108358..ac115edbb 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -283,7 +283,10 @@ add 'track-this' EOF test_expect_success 'git add --dry-run --ignore-missing of non-existing file' ' - test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual.out 2>actual.err && + test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual.out 2>actual.err +' + +test_expect_success C_LOCALE_OUTPUT 'git add --dry-run --ignore-missing of non-existing file output' ' test_cmp expect.out actual.out && test_cmp expect.err actual.err '