Thread (40 messages) flat view 40 messages, 2 authors, 2016-06-15
STALE3734d

[RFC PATCH 05/15] read_tree_recursive: Avoid missing blobs and trees in a sparse repository

From: Elijah Newren <hidden>
Date: 2016-06-15 22:49:29
Subsystem: the rest · Maintainer: Linus Torvalds

Signed-off-by: Elijah Newren <redacted>
---
 t/t5720-sparse-repository-basics.sh |    2 +-
 tree.c                              |    5 +++++
 2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/t/t5720-sparse-repository-basics.sh b/t/t5720-sparse-repository-basics.sh
index b946c23..b11c5ab 100755
--- a/t/t5720-sparse-repository-basics.sh
+++ b/t/t5720-sparse-repository-basics.sh
@@ -81,7 +81,7 @@ known_objects=$(git $srcgit rev-list --objects master \
 		| cut -b -40)
 for i in $(git $srcgit rev-list HEAD | xargs git name-rev | cut -b 42-); do
 	git $srcgit ls-tree -rt $i | grep -F "$known_objects" >expect &&
-	test_expect_failure "plumbing: ls-tree -rt $i works" "
+	test_expect_success "plumbing: ls-tree -rt $i works" "
 		git ls-tree -rt $i 2>error >output &&
 		test_cmp output expect
 	"
diff --git a/tree.c b/tree.c
index 5ab90af..5f9e37a 100644
--- a/tree.c
+++ b/tree.c
@@ -119,6 +119,11 @@ int read_tree_recursive(struct tree *tree,
 		default:
 			return -1;
 		}
+
+		if (git_sparse_pathspecs &&
+		    sha1_object_info(entry.sha1, NULL) <= 0)
+			continue;
+
 		if (S_ISDIR(entry.mode)) {
 			int retval;
 			char *newbase;
-- 
1.7.2.2.140.gd06af
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help