From 8354fa3d4ca50850760ceee9054e3e7a799a4d62 Mon Sep 17 00:00:00 2001 From: David Turner Date: Tue, 27 Sep 2016 16:59:51 -0400 Subject: 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 --- tree-walk.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tree-walk.h') diff --git a/tree-walk.h b/tree-walk.h index 97a7d6957e..68bb78b928 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); -- cgit v1.2.3