Skip to content

cache-tree building fix in the presence of ita entries

Nguyễn Thái Ngọc Duy git 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest4 patches 1 replyIn review
  2. v34 patches 4 repliesSuperseded
  3. v22 patches 7 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v11 patch2 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4test-lib.sh: introduce and use $EMPTY_TREEt/t0000-basic.sh t/t1100-commit-tree-options.sh t/t4010-diff-pathspec.sh +3 more+11 -130 replies
2/4test-lib.sh: introduce and use $EMPTY_BLOBt/t1011-read-tree-sparse-checkout.sh t/t1700-split-index.sh t/t3102-ls-tree-wildcards.sh +5 more+35 -380 replies
3/4cache-tree.c: fix i-t-a entry skipping directory updates sometimescache-tree.c t/t2203-add-intent.sh+19 -20 replies
4/4cache-tree: do not generate empty trees as a result of all i-t-a subentriescache-tree.c t/t2203-add-intent.sh+23 -10 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by.

PatchJunio C Hamano
1/4
2/4
3/4
4/4Noticed-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/4] cache-tree building fix in the presence of ita entries

v4 removes the leading underscore from _EMPTY_BLOB and _EMPTY_TREE and updates 4/4 slightly like this.

cache-tree.c +5 -4
index 2d50640..f28b1f4 100644
@@ -325,6 +325,7 @@ static int update_one(struct cache_tree *it,
 		const unsigned char *sha1;
 		unsigned mode;
 		int expected_missing = 0;
+		int contains_ita = 0;
 
 		path = ce->name;
 		pathlen = ce_namelen(ce);
@@ -341,7 +342,8 @@ static int update_one(struct cache_tree *it,
 			i += sub->count;
 			sha1 = sub->cache_tree->sha1;
 			mode = S_IFDIR;
-			if (sub->cache_tree->entry_count < 0) {
+			contains_ita = sub->cache_tree->entry_count < 0;
+			if (contains_ita) {
 				to_invalidate = 1;
 				expected_missing = 1;
 			}
@@ -381,10 +383,9 @@ static int update_one(struct cache_tree *it,
 		}
 
 		/*
-		 * "sub" can be an empty tree if subentries are i-t-a.
+		 * "sub" can be an empty tree if all subentries are i-t-a.
 		 */
-		if (sub && sub->cache_tree->entry_count < 0 &&
-		    !hashcmp(sha1, EMPTY_TREE_SHA1_BIN))
+		if (contains_ita && !hashcmp(sha1, EMPTY_TREE_SHA1_BIN))
 			continue;
 
 		strbuf_grow(&buffer, entlen + 100);

Nguyễn Thái Ngọc Duy (4):
test-lib.sh: introduce and use $EMPTY_TREE
test-lib.sh: introduce and use $EMPTY_BLOB cache-tree.c: fix i-t-a entry skipping directory updates sometimes
cache-tree: do not generate empty trees as a result of all i-t-a
subentries

 cache-tree.c                         | 14 +++++++++++---
 t/t0000-basic.sh                     |  2 +-
 t/t1011-read-tree-sparse-checkout.sh |  8 ++++----
 t/t1100-commit-tree-options.sh       |  2 +-
 t/t1700-split-index.sh               | 24 ++++++++++++------------
 t/t2203-add-intent.sh                | 31 +++++++++++++++++++++++++++++++
 t/t3102-ls-tree-wildcards.sh         |  8 ++++----
 t/t4010-diff-pathspec.sh             |  2 --
 t/t4054-diff-bogus-tree.sh           | 10 ++++------
 t/t5504-fetch-receive-strict.sh      |  4 ++--
 t/t7011-skip-worktree-reading.sh     | 12 +++++-------
 t/t7012-skip-worktree-writing.sh     | 10 ++++------
 t/t7063-status-untracked-cache.sh    |  6 +++---
 t/t7508-status.sh                    |  2 +-
 t/test-lib.sh                        |  5 ++++-
 15 files changed, 87 insertions(+), 53 deletions(-)
Signature · 1 line
2.9.1.566.gbd532d4