]> git.ipfire.org Git - thirdparty/git.git/blobdiff - tree-walk.h
unpack-trees: let merged_entry() pass through do_add_entry()'s errors
[thirdparty/git.git] / tree-walk.h
index 174eb617dfb9d6a85bcf1e309227c8b724089765..68bb78b928b5059202e5672f445fd5d6e22f9921 100644 (file)
@@ -2,7 +2,7 @@
 #define TREE_WALK_H
 
 struct name_entry {
-       const unsigned char *sha1;
+       const struct object_id *oid;
        const char *path;
        unsigned int mode;
 };
@@ -13,26 +13,34 @@ struct tree_desc {
        unsigned int size;
 };
 
-static inline const unsigned char *tree_entry_extract(struct tree_desc *desc, const char **pathp, unsigned int *modep)
+static inline const struct object_id *tree_entry_extract(struct tree_desc *desc, const char **pathp, unsigned int *modep)
 {
        *pathp = desc->entry.path;
        *modep = desc->entry.mode;
-       return desc->entry.sha1;
+       return desc->entry.oid;
 }
 
 static inline int tree_entry_len(const struct name_entry *ne)
 {
-       return (const char *)ne->sha1 - ne->path - 1;
+       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);