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 <avarab@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Feb 22, 2011 at 23:41 UTC
439fb8296d0a08c09653a45c0f44757c6b9c99b2
3 files changed
+33
-17
builtin/add.c
+4
-4
@@ -307,7 +307,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
307
static struct lock_file lock_file;
308
309
static const char ignore_error[] =
310
-"The following paths are ignored by one of your .gitignore files:\n";
310
+N_("The following paths are ignored by one of your .gitignore files:\n");
311
312
static int verbose = 0, show_only = 0, ignored_too = 0, refresh_only = 0;
313
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)
344
int i, exit_status = 0;
345
346
if (dir->ignored_nr) {
347
- fprintf(stderr, ignore_error);
347
+ fprintf(stderr, _(ignore_error));
348
for (i = 0; i < dir->ignored_nr; i++)
349
fprintf(stderr, "%s\n", dir->ignored[i]->name);
350
- fprintf(stderr, "Use -f if you really want to add them.\n");
351
- die("no files added");
350
+ fprintf(stderr, _("Use -f if you really want to add them.\n"));
351
+ die(_("no files added"));
352
}
353
354
for (i = 0; i < dir->nr; i++)
t/t2204-add-ignored.sh
+25
-12
@@ -31,18 +31,21 @@ do
31
rm -f .git/index &&
32
test_must_fail git add "$i" 2>err &&
33
git ls-files "$i" >out &&
34
- ! test -s out &&
35
- grep -e "Use -f if" err &&
36
- cat err
34
+ ! test -s out
35
+ '
36
+
37
+ test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i output" '
38
+ grep -e "Use -f if" err
39
'
40
41
test_expect_success "complaints for ignored $i with unignored file" '
42
rm -f .git/index &&
43
test_must_fail git add "$i" file 2>err &&
44
git ls-files "$i" >out &&
43
- ! test -s out &&
44
- grep -e "Use -f if" err &&
45
- cat err
45
+ ! test -s out
46
+ '
47
+ test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i with unignored file output" '
48
+ grep -e "Use -f if" err
49
'
50
done
51
@@ -54,9 +57,14 @@ do
57
cd dir &&
58
test_must_fail git add "$i" 2>err &&
59
git ls-files "$i" >out &&
57
- ! test -s out &&
58
- grep -e "Use -f if" err &&
59
- cat err
60
+ ! test -s out
61
+ )
62
+ '
63
+
64
+ test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i in dir output" '
65
+ (
66
+ cd dir &&
67
+ grep -e "Use -f if" err
68
)
69
'
70
done
@@ -69,9 +77,14 @@ do
77
cd sub &&
78
test_must_fail git add "$i" 2>err &&
79
git ls-files "$i" >out &&
72
- ! test -s out &&
73
- grep -e "Use -f if" err &&
74
- cat err
80
+ ! test -s out
81
+ )
82
+ '
83
+
84
+ test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i in sub output" '
85
+ (
86
+ cd sub &&
87
+ grep -e "Use -f if" err
88
)
89
'
90
done
t/t3700-add.sh
+4
-1
@@ -283,7 +283,10 @@ add 'track-this'
283
EOF
284
285
test_expect_success 'git add --dry-run --ignore-missing of non-existing file' '
286
- test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual.out 2>actual.err &&
286
+ test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual.out 2>actual.err
287
+'
288
+
289
+test_expect_success C_LOCALE_OUTPUT 'git add --dry-run --ignore-missing of non-existing file output' '
290
test_cmp expect.out actual.out &&
291
test_cmp expect.err actual.err
292
'