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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Elijah Newren <newren@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]