summaryrefslogtreecommitdiff
path: root/src/tree-cache.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-09-29 08:03:22 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-10-10 19:43:42 +0200
commit795d8e932893b9944c6fe72191cb80c2ccdd5d34 (patch)
tree439ee8bcbd70712a9e3bdd9cca0b0fb41b856dfd /src/tree-cache.c
parentc2f8b215937ed6f17dce94a4bde26d5c83b42533 (diff)
downloadlibgit2-795d8e932893b9944c6fe72191cb80c2ccdd5d34.tar.gz
index: make sure to write cached subtrees if parent is invalidated
If e.g. the root tree is invalidated, we still want to write out its children, since those may still have valid cache entries.
Diffstat (limited to 'src/tree-cache.c')
-rw-r--r--src/tree-cache.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/tree-cache.c b/src/tree-cache.c
index 48dc46a40..bf52b5530 100644
--- a/src/tree-cache.c
+++ b/src/tree-cache.c
@@ -280,10 +280,8 @@ static void write_tree(git_buf *out, git_tree_cache *tree)
git_buf_printf(out, "%s%c%zd %"PRIuZ"\n", tree->name, 0, tree->entry_count, tree->children_count);
- if (tree->entry_count == -1)
- return;
-
- git_buf_put(out, (const char *) &tree->oid, GIT_OID_RAWSZ);
+ if (tree->entry_count != -1)
+ git_buf_put(out, (const char *) &tree->oid, GIT_OID_RAWSZ);
for (i = 0; i < tree->children_count; i++)
write_tree(out, tree->children[i]);