diff options
| author | Brandon Williams <bmwill@google.com> | 2017-05-05 12:53:33 -0700 | 
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2017-05-06 19:15:39 +0900 | 
| commit | 2c1eb104543265c2d26cf36303b35e426dcacf68 (patch) | |
| tree | 8978037ff920390a1c460336201ce383560f68b4 | |
| parent | 0ef8e169aa40ac98dce71f61074bcd729cd9ba54 (diff) | |
| download | git-2c1eb104543265c2d26cf36303b35e426dcacf68.tar.gz | |
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>
| -rw-r--r-- | dir.c | 16 | ||||
| -rw-r--r-- | dir.h | 4 | ||||
| -rw-r--r-- | unpack-trees.c | 2 | 
3 files changed, 12 insertions, 10 deletions
| @@ -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;  		} @@ -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, diff --git a/unpack-trees.c b/unpack-trees.c index d5b401450f..cff6b3f8c4 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -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); | 
