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