X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=tree-walk.h;h=2bf0db9814a5c9f77fe00c97fa4f723986a7aac1;hb=dbdc07fcbe3a951df8a3869b42edb6fffd466486;hp=0089581e1dd55800302799a7381d4a7ad01bd79d;hpb=0814d6e554c45636f41856cc2204abe2f661560c;p=git.git diff --git a/tree-walk.h b/tree-walk.h index 0089581e1..2bf0db981 100644 --- a/tree-walk.h +++ b/tree-walk.h @@ -20,9 +20,9 @@ static inline const unsigned char *tree_entry_extract(struct tree_desc *desc, co return desc->entry.sha1; } -static inline int tree_entry_len(const char *name, const unsigned char *sha1) +static inline int tree_entry_len(const struct name_entry *ne) { - return (const char *)sha1 - name - 1; + return (const char *)ne->sha1 - ne->path - 1; } void update_tree_entry(struct tree_desc *); @@ -58,9 +58,19 @@ extern void setup_traverse_info(struct traverse_info *info, const char *base); static inline int traverse_path_len(const struct traverse_info *info, const struct name_entry *n) { - return info->pathlen + tree_entry_len(n->path, n->sha1); + return info->pathlen + tree_entry_len(n); } -extern int tree_entry_interesting(const struct name_entry *, struct strbuf *, int, const struct pathspec *ps); +/* in general, positive means "kind of interesting" */ +enum interesting { + all_entries_not_interesting = -1, /* no, and no subsequent entries will be either */ + entry_not_interesting = 0, + entry_interesting = 1, + all_entries_interesting = 2 /* yes, and all subsequent entries will be */ +}; + +extern enum interesting tree_entry_interesting(const struct name_entry *, + struct strbuf *, int, + const struct pathspec *ps); #endif