diff options
Diffstat (limited to 'git.h')
-rw-r--r-- | git.h | 60 |
1 files changed, 55 insertions, 5 deletions
@@ -33,6 +33,26 @@ | |||
33 | #include <time.h> | 33 | #include <time.h> |
34 | 34 | ||
35 | 35 | ||
36 | /* On most systems <limits.h> would have given us this, but | ||
37 | * not on some systems (e.g. GNU/Hurd). | ||
38 | */ | ||
39 | #ifndef PATH_MAX | ||
40 | #define PATH_MAX 4096 | ||
41 | #endif | ||
42 | |||
43 | #ifdef __GNUC__ | ||
44 | #define NORETURN __attribute__((__noreturn__)) | ||
45 | #else | ||
46 | #define NORETURN | ||
47 | #ifndef __attribute__ | ||
48 | #define __attribute__(x) | ||
49 | #endif | ||
50 | #endif | ||
51 | |||
52 | |||
53 | extern void die(const char *err, ...) NORETURN __attribute__((format (printf, 1, 2))); | ||
54 | |||
55 | |||
36 | static inline char* xstrdup(const char *str) | 56 | static inline char* xstrdup(const char *str) |
37 | { | 57 | { |
38 | char *ret = strdup(str); | 58 | char *ret = strdup(str); |
@@ -108,9 +128,13 @@ static inline ssize_t xwrite(int fd, const void *buf, size_t len) | |||
108 | #define MINIMUM_ABBREV 4 | 128 | #define MINIMUM_ABBREV 4 |
109 | #define DEFAULT_ABBREV 7 | 129 | #define DEFAULT_ABBREV 7 |
110 | 130 | ||
131 | extern int sha1_object_info(const unsigned char *, char *, unsigned long *); | ||
111 | 132 | ||
112 | extern void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size); | 133 | extern void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size); |
113 | 134 | ||
135 | extern int get_sha1(const char *str, unsigned char *sha1); | ||
136 | extern int get_sha1_hex(const char *hex, unsigned char *sha1); | ||
137 | extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */ | ||
114 | 138 | ||
115 | 139 | ||
116 | 140 | ||
@@ -183,6 +207,21 @@ struct commit { | |||
183 | }; | 207 | }; |
184 | 208 | ||
185 | 209 | ||
210 | struct commit *lookup_commit(const unsigned char *sha1); | ||
211 | struct commit *lookup_commit_reference(const unsigned char *sha1); | ||
212 | struct commit *lookup_commit_reference_gently(const unsigned char *sha1, | ||
213 | int quiet); | ||
214 | |||
215 | int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size); | ||
216 | int parse_commit(struct commit *item); | ||
217 | |||
218 | struct commit_list * commit_list_insert(struct commit *item, struct commit_list **list_p); | ||
219 | struct commit_list * insert_by_date(struct commit *item, struct commit_list **list); | ||
220 | |||
221 | void free_commit_list(struct commit_list *list); | ||
222 | |||
223 | void sort_by_date(struct commit_list **list); | ||
224 | |||
186 | /* Commit formats */ | 225 | /* Commit formats */ |
187 | enum cmit_fmt { | 226 | enum cmit_fmt { |
188 | CMIT_FMT_RAW, | 227 | CMIT_FMT_RAW, |
@@ -197,13 +236,9 @@ enum cmit_fmt { | |||
197 | CMIT_FMT_UNSPECIFIED, | 236 | CMIT_FMT_UNSPECIFIED, |
198 | }; | 237 | }; |
199 | 238 | ||
239 | 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); | ||
200 | 240 | ||
201 | 241 | ||
202 | struct commit *lookup_commit(const unsigned char *sha1); | ||
203 | struct commit *lookup_commit_reference(const unsigned char *sha1); | ||
204 | struct commit *lookup_commit_reference_gently(const unsigned char *sha1, | ||
205 | int quiet); | ||
206 | |||
207 | typedef void (*topo_sort_set_fn_t)(struct commit*, void *data); | 242 | typedef void (*topo_sort_set_fn_t)(struct commit*, void *data); |
208 | typedef void* (*topo_sort_get_fn_t)(struct commit*); | 243 | typedef void* (*topo_sort_get_fn_t)(struct commit*); |
209 | 244 | ||
@@ -306,6 +341,16 @@ enum color_diff { | |||
306 | 341 | ||
307 | 342 | ||
308 | 343 | ||
344 | /* | ||
345 | * from git:refs.g | ||
346 | */ | ||
347 | |||
348 | typedef int each_ref_fn(const char *refname, const unsigned char *sha1, int flags, void *cb_data); | ||
349 | extern int head_ref(each_ref_fn, void *); | ||
350 | extern int for_each_ref(each_ref_fn, void *); | ||
351 | extern int for_each_tag_ref(each_ref_fn, void *); | ||
352 | extern int for_each_branch_ref(each_ref_fn, void *); | ||
353 | extern int for_each_remote_ref(each_ref_fn, void *); | ||
309 | 354 | ||
310 | 355 | ||
311 | 356 | ||
@@ -391,6 +436,11 @@ struct rev_info { | |||
391 | }; | 436 | }; |
392 | 437 | ||
393 | 438 | ||
439 | extern void init_revisions(struct rev_info *revs, const char *prefix); | ||
440 | extern int setup_revisions(int argc, const char **argv, struct rev_info *revs, const char *def); | ||
441 | extern int handle_revision_arg(const char *arg, struct rev_info *revs,int flags,int cant_be_filename); | ||
442 | |||
443 | extern void prepare_revision_walk(struct rev_info *revs); | ||
394 | extern struct commit *get_revision(struct rev_info *revs); | 444 | extern struct commit *get_revision(struct rev_info *revs); |
395 | 445 | ||
396 | 446 | ||