path: root/tree-walk.h
diff options
authorDavid Turner <>2016-09-27 20:59:51 (GMT)
committerJunio C Hamano <>2016-09-27 21:09:10 (GMT)
commit8354fa3d4ca50850760ceee9054e3e7a799a4d62 (patch)
tree2a771cdcd6318f94f12ae0601ceb999335d6a603 /tree-walk.h
parent2edffef2337eae691a454a072e0f9b9538725317 (diff)
fsck: handle bad trees like other errors
Instead of dying when fsck hits a malformed tree object, log the error like any other and continue. Now fsck can tell the user which tree is bad, too. Signed-off-by: David Turner <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'tree-walk.h')
1 files changed, 8 insertions, 0 deletions
diff --git a/tree-walk.h b/tree-walk.h
index 97a7d69..68bb78b 100644
--- a/tree-walk.h
+++ b/tree-walk.h
@@ -25,14 +25,22 @@ static inline int tree_entry_len(const struct name_entry *ne)
return (const char *)ne->oid - ne->path - 1;
+ * The _gently versions of these functions warn and return false on a
+ * corrupt tree entry rather than dying,
+ */
void update_tree_entry(struct tree_desc *);
+int update_tree_entry_gently(struct tree_desc *);
void init_tree_desc(struct tree_desc *desc, const void *buf, unsigned long size);
+int init_tree_desc_gently(struct tree_desc *desc, const void *buf, unsigned long size);
* Helper function that does both tree_entry_extract() and update_tree_entry()
* and returns true for success
int tree_entry(struct tree_desc *, struct name_entry *);
+int tree_entry_gently(struct tree_desc *, struct name_entry *);
void *fill_tree_descriptor(struct tree_desc *desc, const unsigned char *sha1);