aboutsummaryrefslogtreecommitdiffstats
path: root/read-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-05-07 12:47:39 +0900
committerJunio C Hamano <gitster@pobox.com>2021-05-07 12:47:40 +0900
commitfe069dce6251f40eb3d54861500c92afb0e481d9 (patch)
treea414af6ca4ba1fd452249ee59a85157a49bfa119 /read-cache.c
parente706aaf3bc8ad97877cbf21887f96c5af66c7562 (diff)
parentd5f4b8260f623d6fdef36d5eaa8a0c2350390472 (diff)
downloadgit-fe069dce6251f40eb3d54861500c92afb0e481d9.tar.gz
Merge branch 'mt/add-rm-in-sparse-checkout'
"git add" and "git rm" learned not to touch those paths that are outside of sparse checkout. * mt/add-rm-in-sparse-checkout: rm: honor sparse checkout patterns add: warn when asked to update SKIP_WORKTREE entries refresh_index(): add flag to ignore SKIP_WORKTREE entries pathspec: allow to ignore SKIP_WORKTREE entries on index matching add: make --chmod and --renormalize honor sparse checkouts t3705: add tests for `git add` in sparse checkouts add: include magic part of pathspec on --refresh error
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/read-cache.c b/read-cache.c
index eb66fddb1b..aa0c6fe490 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1546,6 +1546,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,
int quiet = (flags & REFRESH_QUIET) != 0;
int not_new = (flags & REFRESH_IGNORE_MISSING) != 0;
int ignore_submodules = (flags & REFRESH_IGNORE_SUBMODULES) != 0;
+ int ignore_skip_worktree = (flags & REFRESH_IGNORE_SKIP_WORKTREE) != 0;
int first = 1;
int in_porcelain = (flags & REFRESH_IN_PORCELAIN);
unsigned int options = (CE_MATCH_REFRESH |
@@ -1590,6 +1591,8 @@ int refresh_index(struct index_state *istate, unsigned int flags,
ce = istate->cache[i];
if (ignore_submodules && S_ISGITLINK(ce->ce_mode))
continue;
+ if (ignore_skip_worktree && ce_skip_worktree(ce))
+ continue;
if (pathspec && !ce_path_match(istate, ce, pathspec, seen))
filtered = 1;