Thread (61 messages) 61 messages, 7 authors, 2021-04-14

[RFC PATCH 4/7] add: make --chmod and --renormalize honor sparse checkouts

flat view
STALE2020d SUPERSEDED

From: Matheus Tavares <hidden>
Date: 2021-02-17 21:03:47
Subsystem: the rest · Maintainer: Linus Torvalds

Status: Superseded by v4 (posted 2021-04-08). [go to v4]

Revision rfc (4 revisions archived).

Revisions (4)
  1. rfc current
  2. v2 [diff against previous]
  3. v3 [diff against previous]
  4. v4 [diff against previous]
Signed-off-by: Matheus Tavares <redacted>
---
 builtin/add.c                  | 5 +++++
 t/t3705-add-sparse-checkout.sh | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/builtin/add.c b/builtin/add.c
index 8c96c23778..e10a039070 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -45,6 +45,9 @@ static void chmod_pathspec(struct pathspec *pathspec, char flip, int show_only)
 	for (i = 0; i < active_nr; i++) {
 		struct cache_entry *ce = active_cache[i];
 
+		if (ce_skip_worktree(ce))
+			continue;
+
 		if (pathspec && !ce_path_match(&the_index, ce, pathspec, NULL))
 			continue;
 
@@ -137,6 +140,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))
diff --git a/t/t3705-add-sparse-checkout.sh b/t/t3705-add-sparse-checkout.sh
index 5530e796b5..f7b0ea782e 100755
--- a/t/t3705-add-sparse-checkout.sh
+++ b/t/t3705-add-sparse-checkout.sh
@@ -75,13 +75,13 @@ test_expect_success 'git add --refresh does not update SKIP_WORKTREE entries' '
 	test_cmp actual expected
 '
 
-test_expect_failure 'git add --chmod does not update SKIP_WORKTREE entries' '
+test_expect_success 'git add --chmod does not update SKIP_WORKTREE entries' '
 	setup_sparse_entry &&
 	git add --chmod=+x sparse_entry &&
 	test_sparse_entry_unchanged
 '
 
-test_expect_failure 'git add --renormalize does not update SKIP_WORKTREE entries' '
+test_expect_success 'git add --renormalize does not update SKIP_WORKTREE entries' '
 	test_config core.autocrlf false &&
 	setup_sparse_entry "LINEONE\r\nLINETWO\r\n" &&
 	echo "sparse_entry text=auto" >.gitattributes &&
-- 
2.29.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help