Skip to content

Commit b39c53e

Browse files
Petr Baudisgitster
authored andcommitted
git-add: Make the "tried to add ignored file" error message less confusing
Currently the error message seems to imply (at least to me) that only the listed files were withheld and the rest of the files was added to the index, even though that's obviously not the case. Signed-off-by: Petr Baudis <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ce312af commit b39c53e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

builtin-add.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ static int git_add_config(const char *var, const char *value)
155155

156156
static struct lock_file lock_file;
157157

158-
static const char ignore_warning[] =
158+
static const char ignore_error[] =
159159
"The following paths are ignored by one of your .gitignore files:\n";
160160

161161
int cmd_add(int argc, const char **argv, const char *prefix)
@@ -250,12 +250,12 @@ int cmd_add(int argc, const char **argv, const char *prefix)
250250
die("index file corrupt");
251251

252252
if (dir.ignored_nr) {
253-
fprintf(stderr, ignore_warning);
253+
fprintf(stderr, ignore_error);
254254
for (i = 0; i < dir.ignored_nr; i++) {
255255
fprintf(stderr, "%s\n", dir.ignored[i]->name);
256256
}
257257
fprintf(stderr, "Use -f if you really want to add them.\n");
258-
exit(1);
258+
die("no files added");
259259
}
260260

261261
for (i = 0; i < dir.nr; i++)

0 commit comments

Comments
 (0)