sha1_file: refactor read_object
[gitweb.git] / builtin / add.c
index 86770d6af4773470cef19ef230a6f0eb8c246a3a..d9a2491e48f16d9ef7de5c05008f8c7e6a5e64b2 100644 (file)
@@ -136,7 +136,7 @@ static char *prune_directory(struct dir_struct *dir, struct pathspec *pathspec,
                        *dst++ = entry;
        }
        dir->nr = dst - dir->entries;
-       add_pathspec_matches_against_index(pathspec, seen);
+       add_pathspec_matches_against_index(pathspec, &the_index, seen);
        return seen;
 }
 
@@ -404,7 +404,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
                }
 
                /* This picks up the paths that are not tracked */
-               baselen = fill_directory(&dir, &pathspec);
+               baselen = fill_directory(&dir, &the_index, &pathspec);
                if (pathspec.nr)
                        seen = prune_directory(&dir, &pathspec, baselen);
        }
@@ -418,7 +418,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
                int i;
 
                if (!seen)
-                       seen = find_pathspecs_matching_against_index(&pathspec);
+                       seen = find_pathspecs_matching_against_index(&pathspec, &the_index);
 
                /*
                 * file_exists() assumes exact match
@@ -440,8 +440,9 @@ int cmd_add(int argc, const char **argv, const char *prefix)
                             !file_exists(path))) {
                                if (ignore_missing) {
                                        int dtype = DT_UNKNOWN;
-                                       if (is_excluded(&dir, path, &dtype))
-                                               dir_add_ignored(&dir, path, pathspec.items[i].len);
+                                       if (is_excluded(&dir, &the_index, path, &dtype))
+                                               dir_add_ignored(&dir, &the_index,
+                                                               path, pathspec.items[i].len);
                                } else
                                        die(_("pathspec '%s' did not match any files"),
                                            pathspec.items[i].original);