-rw-r--r-- | git.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -185,192 +185,196 @@ enum grep_pat_token { }; enum grep_context { GREP_CONTEXT_HEAD, GREP_CONTEXT_BODY, }; struct grep_pat { struct grep_pat *next; const char *origin; int no; enum grep_pat_token token; const char *pattern; regex_t regexp; }; enum grep_expr_node { GREP_NODE_ATOM, GREP_NODE_NOT, GREP_NODE_AND, GREP_NODE_OR, }; struct grep_opt { struct grep_pat *pattern_list; struct grep_pat **pattern_tail; struct grep_expr *pattern_expression; int prefix_length; regex_t regexp; unsigned linenum:1; unsigned invert:1; unsigned status_only:1; unsigned name_only:1; unsigned unmatch_name_only:1; unsigned count:1; unsigned word_regexp:1; unsigned fixed:1; unsigned all_match:1; #define GREP_BINARY_DEFAULT 0 #define GREP_BINARY_NOMATCH 1 #define GREP_BINARY_TEXT 2 unsigned binary:2; unsigned extended:1; unsigned relative:1; unsigned pathname:1; int regflags; unsigned pre_context; unsigned post_context; }; extern void compile_grep_patterns(struct grep_opt *opt); extern void free_grep_patterns(struct grep_opt *opt); /* * from git:object.h */ extern const char *type_names[9]; struct object_list { struct object *item; struct object_list *next; }; struct object_refs { unsigned count; struct object *base; struct object *ref[FLEX_ARRAY]; /* more */ }; struct object_array { unsigned int nr; unsigned int alloc; struct object_array_entry { struct object *item; const char *name; } *objects; }; #define TYPE_BITS 3 #define FLAG_BITS 27 /* * The object type is stored in 3 bits. */ struct object { unsigned parsed : 1; unsigned used : 1; unsigned type : TYPE_BITS; unsigned flags : FLAG_BITS; unsigned char sha1[20]; }; +/** Returns the object, having parsed it to find out what it is. **/ +struct object *parse_object(const unsigned char *sha1); + + /* * from git:tree.h */ struct tree { struct object object; void *buffer; unsigned long size; }; struct tree *lookup_tree(const unsigned char *sha1); int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size); int parse_tree(struct tree *tree); struct tree *parse_tree_indirect(const unsigned char *sha1); typedef int (*read_tree_fn_t)(const unsigned char *, const char *, int, const char *, unsigned int, int); extern int read_tree_recursive(struct tree *tree, const char *base, int baselen, int stage, const char **match, read_tree_fn_t fn); extern int read_tree(struct tree *tree, int stage, const char **paths); /* from git:commit.h */ struct commit_list { struct commit *item; struct commit_list *next; }; struct commit { struct object object; void *util; unsigned long date; struct commit_list *parents; struct tree *tree; char *buffer; }; struct commit *lookup_commit(const unsigned char *sha1); struct commit *lookup_commit_reference(const unsigned char *sha1); struct commit *lookup_commit_reference_gently(const unsigned char *sha1, int quiet); int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size); int parse_commit(struct commit *item); struct commit_list * commit_list_insert(struct commit *item, struct commit_list **list_p); struct commit_list * insert_by_date(struct commit *item, struct commit_list **list); void free_commit_list(struct commit_list *list); void sort_by_date(struct commit_list **list); /* Commit formats */ enum cmit_fmt { CMIT_FMT_RAW, CMIT_FMT_MEDIUM, CMIT_FMT_DEFAULT = CMIT_FMT_MEDIUM, CMIT_FMT_SHORT, CMIT_FMT_FULL, CMIT_FMT_FULLER, CMIT_FMT_ONELINE, CMIT_FMT_EMAIL, CMIT_FMT_UNSPECIFIED, }; extern unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *, unsigned long len, char *buf, unsigned long space, int abbrev, const char *subject, const char *after_subject, int relative_date); typedef void (*topo_sort_set_fn_t)(struct commit*, void *data); typedef void* (*topo_sort_get_fn_t)(struct commit*); /* * from git:tag.h */ extern const char *tag_type; struct tag { struct object object; struct object *tagged; char *tag; char *signature; /* not actually implemented */ }; extern struct tag *lookup_tag(const unsigned char *sha1); extern int parse_tag_buffer(struct tag *item, void *data, unsigned long size); extern int parse_tag(struct tag *item); |