author | Lars Hjemli <hjemli@gmail.com> | 2007-01-17 00:07:31 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-01-17 00:07:31 (UTC) |
commit | 06c81d6faafff1c80bc9e2302e5b8fea393b775b (patch) (side-by-side diff) | |
tree | 29f0e08e98110984299989f7abf80868793ea51d | |
parent | 66091f934a2d064ae55095cdc5ae008b43ea60fe (diff) | |
download | cgit-06c81d6faafff1c80bc9e2302e5b8fea393b775b.zip cgit-06c81d6faafff1c80bc9e2302e5b8fea393b775b.tar.gz cgit-06c81d6faafff1c80bc9e2302e5b8fea393b775b.tar.bz2 |
Add some more decls from git (cache.h, tag.h)
This is in preparation for extended tag support in cgit
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | git.h | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -103,48 +103,61 @@ static inline ssize_t xread(int fd, void *buf, size_t len) continue; return nr; } } static inline ssize_t xwrite(int fd, const void *buf, size_t len) { ssize_t nr; while (1) { nr = write(fd, buf, len); if ((nr < 0) && (errno == EAGAIN || errno == EINTR)) continue; return nr; } } /* * from git:cache.h */ +enum object_type { + OBJ_NONE = 0, + OBJ_COMMIT = 1, + OBJ_TREE = 2, + OBJ_BLOB = 3, + OBJ_TAG = 4, + /* 5 for future expansion */ + OBJ_OFS_DELTA = 6, + OBJ_REF_DELTA = 7, + OBJ_BAD, +}; + + /* Convert to/from hex/sha1 representation */ #define MINIMUM_ABBREV 4 #define DEFAULT_ABBREV 7 extern const unsigned char null_sha1[20]; extern int sha1_object_info(const unsigned char *, char *, unsigned long *); extern void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size); extern int get_sha1(const char *str, unsigned char *sha1); extern int get_sha1_hex(const char *hex, unsigned char *sha1); extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */ static inline int is_null_sha1(const unsigned char *sha1) { return !memcmp(sha1, null_sha1, 20); } static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2) { return memcmp(sha1, sha2, 20); } static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src) { @@ -207,48 +220,50 @@ struct grep_opt { 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 /* @@ -323,48 +338,67 @@ 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); +extern struct object *deref_tag(struct object *, const char *, int); + + +/* * from git:diffcore.h */ struct diff_filespec { unsigned char sha1[20]; char *path; void *data; void *cnt_data; unsigned long size; int xfrm_flags; /* for use by the xfrm */ unsigned short mode; /* file mode */ unsigned sha1_valid : 1; /* if true, use sha1 and trust mode; * if false, use the name and read from * the filesystem. */ #define DIFF_FILE_VALID(spec) (((spec)->mode) != 0) unsigned should_free : 1; /* data should be free()'ed */ unsigned should_munmap : 1; /* data should be munmap()'ed */ }; struct diff_filepair { struct diff_filespec *one; struct diff_filespec *two; unsigned short int score; |