Skip to content

Commit eb69934

Browse files
committed
builtin/add.c: use path_excluded()
This only happens in --ignore-missing --dry-run codepath which presumably nobody should care, but is for completeness. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 782cd4c commit eb69934

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

builtin/add.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,21 +441,25 @@ int cmd_add(int argc, const char **argv, const char *prefix)
441441

442442
if (pathspec) {
443443
int i;
444+
struct path_exclude_check check;
445+
446+
path_exclude_check_init(&check, &dir);
444447
if (!seen)
445448
seen = find_used_pathspec(pathspec);
446449
for (i = 0; pathspec[i]; i++) {
447450
if (!seen[i] && pathspec[i][0]
448451
&& !file_exists(pathspec[i])) {
449452
if (ignore_missing) {
450453
int dtype = DT_UNKNOWN;
451-
if (excluded(&dir, pathspec[i], &dtype))
454+
if (path_excluded(&check, pathspec[i], -1, &dtype))
452455
dir_add_ignored(&dir, pathspec[i], strlen(pathspec[i]));
453456
} else
454457
die(_("pathspec '%s' did not match any files"),
455458
pathspec[i]);
456459
}
457460
}
458461
free(seen);
462+
path_exclude_check_clear(&check);
459463
}
460464

461465
exit_status |= add_files_to_cache(prefix, pathspec, flags);

0 commit comments

Comments
 (0)