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>
This commit is contained in:
Ævar Arnfjörð Bjarmason 2011-02-22 23:41:30 +00:00 коммит произвёл Junio C Hamano
Родитель 990ac4be0a
Коммит 439fb8296d
3 изменённых файлов: 33 добавлений и 17 удалений

Просмотреть файл

@ -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++)

Просмотреть файл

@ -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

Просмотреть файл

@ -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
'