Skip to content

Commit

Permalink
builtin/add.c: use path_excluded()
Browse files Browse the repository at this point in the history
This only happens in --ignore-missing --dry-run codepath which
presumably nobody should care, but is for completeness.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Jun 6, 2012
1 parent 782cd4c commit eb69934
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion builtin/add.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,21 +441,25 @@ int cmd_add(int argc, const char **argv, const char *prefix)

if (pathspec) {
int i;
struct path_exclude_check check;

path_exclude_check_init(&check, &dir);
if (!seen)
seen = find_used_pathspec(pathspec);
for (i = 0; pathspec[i]; i++) {
if (!seen[i] && pathspec[i][0]
&& !file_exists(pathspec[i])) {
if (ignore_missing) {
int dtype = DT_UNKNOWN;
if (excluded(&dir, pathspec[i], &dtype))
if (path_excluded(&check, pathspec[i], -1, &dtype))
dir_add_ignored(&dir, pathspec[i], strlen(pathspec[i]));
} else
die(_("pathspec '%s' did not match any files"),
pathspec[i]);
}
}
free(seen);
path_exclude_check_clear(&check);
}

exit_status |= add_files_to_cache(prefix, pathspec, flags);
Expand Down

0 comments on commit eb69934

Please sign in to comment.