Merge branch 'nd/sparse'
* nd/sparse: (25 commits) t7002: test for not using external grep on skip-worktree paths t7002: set test prerequisite "external-grep" if supported grep: do not do external grep on skip-worktree entries commit: correctly respect skip-worktree bit ie_match_stat(): do not ignore skip-worktree bit with CE_MATCH_IGNORE_VALID tests: rename duplicate t1009 sparse checkout: inhibit empty worktree Add tests for sparse checkout read-tree: add --no-sparse-checkout to disable sparse checkout support unpack-trees(): ignore worktree check outside checkout area unpack_trees(): apply $GIT_DIR/info/sparse-checkout to the final index unpack-trees(): "enable" sparse checkout and load $GIT_DIR/info/sparse-checkout unpack-trees.c: generalize verify_* functions unpack-trees(): add CE_WT_REMOVE to remove on worktree alone Introduce "sparse checkout" dir.c: export excluded_1() and add_excludes_from_file_1() excluded_1(): support exclude files in index unpack-trees(): carry skip-worktree bit over in merged_entry() Read .gitignore from index if it is skip-worktree Avoid writing to buffer in add_excludes_from_file_1() ... Conflicts: .gitignore Documentation/config.txt Documentation/git-update-index.txt Makefile entry.c t/t7002-grep.sh
This commit is contained in:
@ -183,11 +183,15 @@ static int list_paths(struct string_list *list, const char *with_tree,
|
||||
|
||||
for (i = 0; i < active_nr; i++) {
|
||||
struct cache_entry *ce = active_cache[i];
|
||||
struct string_list_item *item;
|
||||
|
||||
if (ce->ce_flags & CE_UPDATE)
|
||||
continue;
|
||||
if (!match_pathspec(pattern, ce->name, ce_namelen(ce), 0, m))
|
||||
continue;
|
||||
string_list_insert(ce->name, list);
|
||||
item = string_list_insert(ce->name, list);
|
||||
if (ce_skip_worktree(ce))
|
||||
item->util = item; /* better a valid pointer than a fake one */
|
||||
}
|
||||
|
||||
return report_path_error(m, pattern, prefix ? strlen(prefix) : 0);
|
||||
@ -200,6 +204,10 @@ static void add_remove_files(struct string_list *list)
|
||||
struct stat st;
|
||||
struct string_list_item *p = &(list->items[i]);
|
||||
|
||||
/* p->util is skip-worktree */
|
||||
if (p->util)
|
||||
continue;
|
||||
|
||||
if (!lstat(p->string, &st)) {
|
||||
if (add_to_cache(p->string, &st, 0))
|
||||
die("updating files failed");
|
||||
|
Reference in New Issue
Block a user