|
diff --git a/git.h b/git.h index b1e4828..991eaa5 100644 --- a/ git.h+++ b/ git.h |
|
@@ -111,32 +111,45 @@ static inline ssize_t xwrite(int fd, const void *buf, size_t len) |
111 | while (1) { |
111 | while (1) { |
112 | nr = write(fd, buf, len); |
112 | nr = write(fd, buf, len); |
113 | if ((nr < 0) && (errno == EAGAIN || errno == EINTR)) |
113 | if ((nr < 0) && (errno == EAGAIN || errno == EINTR)) |
114 | continue; |
114 | continue; |
115 | return nr; |
115 | return nr; |
116 | } |
116 | } |
117 | } |
117 | } |
118 | |
118 | |
119 | |
119 | |
120 | |
120 | |
121 | |
121 | |
122 | /* |
122 | /* |
123 | * from git:cache.h |
123 | * from git:cache.h |
124 | */ |
124 | */ |
125 | |
125 | |
126 | |
126 | |
| |
127 | enum object_type { |
| |
128 | OBJ_NONE = 0, |
| |
129 | OBJ_COMMIT = 1, |
| |
130 | OBJ_TREE = 2, |
| |
131 | OBJ_BLOB = 3, |
| |
132 | OBJ_TAG = 4, |
| |
133 | /* 5 for future expansion */ |
| |
134 | OBJ_OFS_DELTA = 6, |
| |
135 | OBJ_REF_DELTA = 7, |
| |
136 | OBJ_BAD, |
| |
137 | }; |
| |
138 | |
| |
139 | |
127 | /* Convert to/from hex/sha1 representation */ |
140 | /* Convert to/from hex/sha1 representation */ |
128 | #define MINIMUM_ABBREV 4 |
141 | #define MINIMUM_ABBREV 4 |
129 | #define DEFAULT_ABBREV 7 |
142 | #define DEFAULT_ABBREV 7 |
130 | |
143 | |
131 | extern const unsigned char null_sha1[20]; |
144 | extern const unsigned char null_sha1[20]; |
132 | |
145 | |
133 | extern int sha1_object_info(const unsigned char *, char *, unsigned long *); |
146 | extern int sha1_object_info(const unsigned char *, char *, unsigned long *); |
134 | |
147 | |
135 | extern void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size); |
148 | extern void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size); |
136 | |
149 | |
137 | extern int get_sha1(const char *str, unsigned char *sha1); |
150 | extern int get_sha1(const char *str, unsigned char *sha1); |
138 | extern int get_sha1_hex(const char *hex, unsigned char *sha1); |
151 | extern int get_sha1_hex(const char *hex, unsigned char *sha1); |
139 | extern char *sha1_to_hex(const unsigned char *sha1);/* static buffer result! */ |
152 | extern char *sha1_to_hex(const unsigned char *sha1);/* static buffer result! */ |
140 | |
153 | |
141 | static inline int is_null_sha1(const unsigned char *sha1) |
154 | static inline int is_null_sha1(const unsigned char *sha1) |
142 | { |
155 | { |
@@ -215,32 +228,34 @@ struct grep_opt { |
215 | unsigned relative:1; |
228 | unsigned relative:1; |
216 | unsigned pathname:1; |
229 | unsigned pathname:1; |
217 | int regflags; |
230 | int regflags; |
218 | unsigned pre_context; |
231 | unsigned pre_context; |
219 | unsigned post_context; |
232 | unsigned post_context; |
220 | }; |
233 | }; |
221 | |
234 | |
222 | |
235 | |
223 | extern void compile_grep_patterns(struct grep_opt *opt); |
236 | extern void compile_grep_patterns(struct grep_opt *opt); |
224 | extern void free_grep_patterns(struct grep_opt *opt); |
237 | extern void free_grep_patterns(struct grep_opt *opt); |
225 | |
238 | |
226 | |
239 | |
227 | /* |
240 | /* |
228 | * from git:object.h |
241 | * from git:object.h |
229 | */ |
242 | */ |
230 | |
243 | |
| |
244 | extern const char *type_names[9]; |
| |
245 | |
231 | struct object_list { |
246 | struct object_list { |
232 | struct object *item; |
247 | struct object *item; |
233 | struct object_list *next; |
248 | struct object_list *next; |
234 | }; |
249 | }; |
235 | |
250 | |
236 | struct object_refs { |
251 | struct object_refs { |
237 | unsigned count; |
252 | unsigned count; |
238 | struct object *base; |
253 | struct object *base; |
239 | struct object *ref[FLEX_ARRAY]; /* more */ |
254 | struct object *ref[FLEX_ARRAY]; /* more */ |
240 | }; |
255 | }; |
241 | |
256 | |
242 | struct object_array { |
257 | struct object_array { |
243 | unsigned int nr; |
258 | unsigned int nr; |
244 | unsigned int alloc; |
259 | unsigned int alloc; |
245 | struct object_array_entry { |
260 | struct object_array_entry { |
246 | struct object *item; |
261 | struct object *item; |
@@ -331,32 +346,51 @@ enum cmit_fmt { |
331 | CMIT_FMT_FULLER, |
346 | CMIT_FMT_FULLER, |
332 | CMIT_FMT_ONELINE, |
347 | CMIT_FMT_ONELINE, |
333 | CMIT_FMT_EMAIL, |
348 | CMIT_FMT_EMAIL, |
334 | |
349 | |
335 | CMIT_FMT_UNSPECIFIED, |
350 | CMIT_FMT_UNSPECIFIED, |
336 | }; |
351 | }; |
337 | |
352 | |
338 | 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); |
353 | 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); |
339 | |
354 | |
340 | |
355 | |
341 | typedef void (*topo_sort_set_fn_t)(struct commit*, void *data); |
356 | typedef void (*topo_sort_set_fn_t)(struct commit*, void *data); |
342 | typedef void* (*topo_sort_get_fn_t)(struct commit*); |
357 | typedef void* (*topo_sort_get_fn_t)(struct commit*); |
343 | |
358 | |
344 | |
359 | |
345 | |
360 | |
346 | /* |
361 | /* |
| |
362 | * from git:tag.h |
| |
363 | */ |
| |
364 | |
| |
365 | extern const char *tag_type; |
| |
366 | |
| |
367 | struct tag { |
| |
368 | struct object object; |
| |
369 | struct object *tagged; |
| |
370 | char *tag; |
| |
371 | char *signature; /* not actually implemented */ |
| |
372 | }; |
| |
373 | |
| |
374 | extern struct tag *lookup_tag(const unsigned char *sha1); |
| |
375 | extern int parse_tag_buffer(struct tag *item, void *data, unsigned long size); |
| |
376 | extern int parse_tag(struct tag *item); |
| |
377 | extern struct object *deref_tag(struct object *, const char *, int); |
| |
378 | |
| |
379 | |
| |
380 | /* |
347 | * from git:diffcore.h |
381 | * from git:diffcore.h |
348 | */ |
382 | */ |
349 | |
383 | |
350 | struct diff_filespec { |
384 | struct diff_filespec { |
351 | unsigned char sha1[20]; |
385 | unsigned char sha1[20]; |
352 | char *path; |
386 | char *path; |
353 | void *data; |
387 | void *data; |
354 | void *cnt_data; |
388 | void *cnt_data; |
355 | unsigned long size; |
389 | unsigned long size; |
356 | int xfrm_flags; /* for use by the xfrm */ |
390 | int xfrm_flags; /* for use by the xfrm */ |
357 | unsigned short mode; /* file mode */ |
391 | unsigned short mode; /* file mode */ |
358 | unsigned sha1_valid : 1; /* if true, use sha1 and trust mode; |
392 | unsigned sha1_valid : 1; /* if true, use sha1 and trust mode; |
359 | * if false, use the name and read from |
393 | * if false, use the name and read from |
360 | * the filesystem. |
394 | * the filesystem. |
361 | */ |
395 | */ |
362 | #define DIFF_FILE_VALID(spec) (((spec)->mode) != 0) |
396 | #define DIFF_FILE_VALID(spec) (((spec)->mode) != 0) |
|