mirror of
https://github.com/git/git
synced 2024-08-25 02:35:46 +00:00
dir: convert read_directory to take an index
Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
0ef8e169aa
commit
2c1eb10454
16
dir.c
16
dir.c
|
@ -190,7 +190,7 @@ int fill_directory(struct dir_struct *dir, const struct pathspec *pathspec)
|
|||
prefix = prefix_len ? pathspec->items[0].match : "";
|
||||
|
||||
/* Read the directory and prune it */
|
||||
read_directory(dir, prefix, prefix_len, pathspec);
|
||||
read_directory(dir, &the_index, prefix, prefix_len, pathspec);
|
||||
|
||||
return prefix_len;
|
||||
}
|
||||
|
@ -2071,8 +2071,8 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
|
|||
return root;
|
||||
}
|
||||
|
||||
int read_directory(struct dir_struct *dir, const char *path,
|
||||
int len, const struct pathspec *pathspec)
|
||||
int read_directory(struct dir_struct *dir, struct index_state *istate,
|
||||
const char *path, int len, const struct pathspec *pathspec)
|
||||
{
|
||||
struct untracked_cache_dir *untracked;
|
||||
|
||||
|
@ -2086,8 +2086,8 @@ int read_directory(struct dir_struct *dir, const char *path,
|
|||
* e.g. prep_exclude()
|
||||
*/
|
||||
dir->untracked = NULL;
|
||||
if (!len || treat_leading_path(dir, &the_index, path, len, pathspec))
|
||||
read_directory_recursive(dir, &the_index, path, len, untracked, 0, pathspec);
|
||||
if (!len || treat_leading_path(dir, istate, path, len, pathspec))
|
||||
read_directory_recursive(dir, istate, path, len, untracked, 0, pathspec);
|
||||
QSORT(dir->entries, dir->nr, cmp_name);
|
||||
QSORT(dir->ignored, dir->ignored_nr, cmp_name);
|
||||
if (dir->untracked) {
|
||||
|
@ -2101,12 +2101,12 @@ int read_directory(struct dir_struct *dir, const char *path,
|
|||
dir->untracked->gitignore_invalidated,
|
||||
dir->untracked->dir_invalidated,
|
||||
dir->untracked->dir_opened);
|
||||
if (dir->untracked == the_index.untracked &&
|
||||
if (dir->untracked == istate->untracked &&
|
||||
(dir->untracked->dir_opened ||
|
||||
dir->untracked->gitignore_invalidated ||
|
||||
dir->untracked->dir_invalidated))
|
||||
the_index.cache_changed |= UNTRACKED_CHANGED;
|
||||
if (dir->untracked != the_index.untracked) {
|
||||
istate->cache_changed |= UNTRACKED_CHANGED;
|
||||
if (dir->untracked != istate->untracked) {
|
||||
free(dir->untracked);
|
||||
dir->untracked = NULL;
|
||||
}
|
||||
|
|
4
dir.h
4
dir.h
|
@ -215,7 +215,9 @@ extern int report_path_error(const char *ps_matched, const struct pathspec *path
|
|||
extern int within_depth(const char *name, int namelen, int depth, int max_depth);
|
||||
|
||||
extern int fill_directory(struct dir_struct *dir, const struct pathspec *pathspec);
|
||||
extern int read_directory(struct dir_struct *, const char *path, int len, const struct pathspec *pathspec);
|
||||
extern int read_directory(struct dir_struct *, struct index_state *istate,
|
||||
const char *path, int len,
|
||||
const struct pathspec *pathspec);
|
||||
|
||||
extern int is_excluded_from_list(const char *pathname, int pathlen,
|
||||
const char *basename, int *dtype,
|
||||
|
|
|
@ -1592,7 +1592,7 @@ static int verify_clean_subdirectory(const struct cache_entry *ce,
|
|||
memset(&d, 0, sizeof(d));
|
||||
if (o->dir)
|
||||
d.exclude_per_dir = o->dir->exclude_per_dir;
|
||||
i = read_directory(&d, pathbuf, namelen+1, NULL);
|
||||
i = read_directory(&d, &the_index, pathbuf, namelen+1, NULL);
|
||||
if (i)
|
||||
return o->gently ? -1 :
|
||||
add_rejected_path(o, ERROR_NOT_UPTODATE_DIR, ce->name);
|
||||
|
|
Loading…
Reference in a new issue