5 const unsigned char *sha1;
10 static inline enum object_type object_type(unsigned int mode)
12 return S_ISDIR(mode) ? OBJ_TREE :
13 S_ISGITLINK(mode) ? OBJ_COMMIT :
19 struct name_entry entry;
23 static inline const unsigned char *tree_entry_extract(struct tree_desc *desc, const char **pathp, unsigned int *modep)
25 *pathp = desc->entry.path;
26 *modep = canon_mode(desc->entry.mode);
27 return desc->entry.sha1;
30 static inline int tree_entry_len(const char *name, const unsigned char *sha1)
32 return (const char *)sha1 - name - 1;
35 void update_tree_entry(struct tree_desc *);
36 void init_tree_desc(struct tree_desc *desc, const void *buf, unsigned long size);
38 /* Helper function that does both of the above and returns true for success */
39 int tree_entry(struct tree_desc *, struct name_entry *);
41 void *fill_tree_descriptor(struct tree_desc *desc, const unsigned char *sha1);
43 typedef void (*traverse_callback_t)(int n, unsigned long mask, struct name_entry *entry, const char *base);
45 void traverse_trees(int n, struct tree_desc *t, const char *base, traverse_callback_t callback);
47 int get_tree_entry(const unsigned char *, const char *, unsigned char *, unsigned *);