]> Pileus Git - ~andy/git/commitdiff
i18n: git-add "The following paths are ignored" message
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 22 Feb 2011 23:41:30 +0000 (23:41 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 10 Mar 2011 07:52:53 +0000 (23:52 -0800)
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>
builtin/add.c
t/t2204-add-ignored.sh
t/t3700-add.sh

index a9a78f4bdab3a2839c768844ba28b403e75cc13d..21776ac52befa8e29b23de6176563fea3461fd7b 100644 (file)
@@ -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++)
index 24afdabab7e30feaf583079a75a756d267181bb9..49753362f0974627f1b5e5e11144484238875494 100755 (executable)
@@ -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
index ec7108358e7b7f54f0b5e7530c8368e4a56576af..ac115edbb7653a682002b872e6d9463b09ef5d94 100755 (executable)
@@ -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
 '