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 <gitster@pobox.com>

Junio C Hamano committed Jun 5, 2012 at 21:44 UTC eb69934bbd1200a318422c0d127c043d6b8457e1
1 file changed +5 -1
builtin/add.c
+5 -1
@@ -441,6 +441,9 @@ int cmd_add(int argc, const char **argv, const char *prefix)
441
442 if (pathspec) {
443 int i;
444 + struct path_exclude_check check;
445 +
446 + path_exclude_check_init(&check, &dir);
447 if (!seen)
448 seen = find_used_pathspec(pathspec);
449 for (i = 0; pathspec[i]; i++) {
@@ -448,7 +451,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
451 && !file_exists(pathspec[i])) {
452 if (ignore_missing) {
453 int dtype = DT_UNKNOWN;
451 - if (excluded(&dir, pathspec[i], &dtype))
454 + if (path_excluded(&check, pathspec[i], -1, &dtype))
455 dir_add_ignored(&dir, pathspec[i], strlen(pathspec[i]));
456 } else
457 die(_("pathspec '%s' did not match any files"),
@@ -456,6 +459,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
459 }
460 }
461 free(seen);
462 + path_exclude_check_clear(&check);
463 }
464
465 exit_status |= add_files_to_cache(prefix, pathspec, flags);