summaryrefslogtreecommitdiff
path: root/builtin/add.c
diff options
context:
space:
mode:
authorLibravatar Matheus Tavares <matheus.bernardino@usp.br>2021-04-08 17:41:24 -0300
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-04-08 14:18:03 -0700
commitd73dbafc2c25eb45090d6aa9d56fc21b40c78083 (patch)
tree5efc03430548deb9c823dd48c6bbc295d6f79ac7 /builtin/add.c
parentt3705: add tests for `git add` in sparse checkouts (diff)
downloadtgif-d73dbafc2c25eb45090d6aa9d56fc21b40c78083.tar.xz
add: make --chmod and --renormalize honor sparse checkouts
Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/add.c')
-rw-r--r--builtin/add.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/builtin/add.c b/builtin/add.c
index 24ed7e25f3..5fec21a792 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -46,6 +46,9 @@ static int chmod_pathspec(struct pathspec *pathspec, char flip, int show_only)
struct cache_entry *ce = active_cache[i];
int err;
+ if (ce_skip_worktree(ce))
+ continue;
+
if (pathspec && !ce_path_match(&the_index, ce, pathspec, NULL))
continue;
@@ -144,6 +147,8 @@ static int renormalize_tracked_files(const struct pathspec *pathspec, int flags)
for (i = 0; i < active_nr; i++) {
struct cache_entry *ce = active_cache[i];
+ if (ce_skip_worktree(ce))
+ continue;
if (ce_stage(ce))
continue; /* do not touch unmerged paths */
if (!S_ISREG(ce->ce_mode) && !S_ISLNK(ce->ce_mode))