summaryrefslogtreecommitdiffabout
path: root/git.h
Unidiff
Diffstat (limited to 'git.h') (more/less context) (ignore whitespace changes)
-rw-r--r--git.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/git.h b/git.h
index 991eaa5..eca48d5 100644
--- a/git.h
+++ b/git.h
@@ -185,192 +185,196 @@ enum grep_pat_token {
185}; 185};
186 186
187enum grep_context { 187enum grep_context {
188 GREP_CONTEXT_HEAD, 188 GREP_CONTEXT_HEAD,
189 GREP_CONTEXT_BODY, 189 GREP_CONTEXT_BODY,
190}; 190};
191 191
192struct grep_pat { 192struct grep_pat {
193 struct grep_pat *next; 193 struct grep_pat *next;
194 const char *origin; 194 const char *origin;
195 int no; 195 int no;
196 enum grep_pat_token token; 196 enum grep_pat_token token;
197 const char *pattern; 197 const char *pattern;
198 regex_t regexp; 198 regex_t regexp;
199}; 199};
200 200
201enum grep_expr_node { 201enum grep_expr_node {
202 GREP_NODE_ATOM, 202 GREP_NODE_ATOM,
203 GREP_NODE_NOT, 203 GREP_NODE_NOT,
204 GREP_NODE_AND, 204 GREP_NODE_AND,
205 GREP_NODE_OR, 205 GREP_NODE_OR,
206}; 206};
207 207
208struct grep_opt { 208struct grep_opt {
209 struct grep_pat *pattern_list; 209 struct grep_pat *pattern_list;
210 struct grep_pat **pattern_tail; 210 struct grep_pat **pattern_tail;
211 struct grep_expr *pattern_expression; 211 struct grep_expr *pattern_expression;
212 int prefix_length; 212 int prefix_length;
213 regex_t regexp; 213 regex_t regexp;
214 unsigned linenum:1; 214 unsigned linenum:1;
215 unsigned invert:1; 215 unsigned invert:1;
216 unsigned status_only:1; 216 unsigned status_only:1;
217 unsigned name_only:1; 217 unsigned name_only:1;
218 unsigned unmatch_name_only:1; 218 unsigned unmatch_name_only:1;
219 unsigned count:1; 219 unsigned count:1;
220 unsigned word_regexp:1; 220 unsigned word_regexp:1;
221 unsigned fixed:1; 221 unsigned fixed:1;
222 unsigned all_match:1; 222 unsigned all_match:1;
223#define GREP_BINARY_DEFAULT 0 223#define GREP_BINARY_DEFAULT 0
224#define GREP_BINARY_NOMATCH 1 224#define GREP_BINARY_NOMATCH 1
225#define GREP_BINARY_TEXT 2 225#define GREP_BINARY_TEXT 2
226 unsigned binary:2; 226 unsigned binary:2;
227 unsigned extended:1; 227 unsigned extended:1;
228 unsigned relative:1; 228 unsigned relative:1;
229 unsigned pathname:1; 229 unsigned pathname:1;
230 int regflags; 230 int regflags;
231 unsigned pre_context; 231 unsigned pre_context;
232 unsigned post_context; 232 unsigned post_context;
233}; 233};
234 234
235 235
236extern void compile_grep_patterns(struct grep_opt *opt); 236extern void compile_grep_patterns(struct grep_opt *opt);
237extern void free_grep_patterns(struct grep_opt *opt); 237extern void free_grep_patterns(struct grep_opt *opt);
238 238
239 239
240/* 240/*
241 * from git:object.h 241 * from git:object.h
242 */ 242 */
243 243
244extern const char *type_names[9]; 244extern const char *type_names[9];
245 245
246struct object_list { 246struct object_list {
247 struct object *item; 247 struct object *item;
248 struct object_list *next; 248 struct object_list *next;
249}; 249};
250 250
251struct object_refs { 251struct object_refs {
252 unsigned count; 252 unsigned count;
253 struct object *base; 253 struct object *base;
254 struct object *ref[FLEX_ARRAY]; /* more */ 254 struct object *ref[FLEX_ARRAY]; /* more */
255}; 255};
256 256
257struct object_array { 257struct object_array {
258 unsigned int nr; 258 unsigned int nr;
259 unsigned int alloc; 259 unsigned int alloc;
260 struct object_array_entry { 260 struct object_array_entry {
261 struct object *item; 261 struct object *item;
262 const char *name; 262 const char *name;
263 } *objects; 263 } *objects;
264}; 264};
265 265
266#define TYPE_BITS 3 266#define TYPE_BITS 3
267#define FLAG_BITS 27 267#define FLAG_BITS 27
268 268
269/* 269/*
270 * The object type is stored in 3 bits. 270 * The object type is stored in 3 bits.
271 */ 271 */
272struct object { 272struct object {
273 unsigned parsed : 1; 273 unsigned parsed : 1;
274 unsigned used : 1; 274 unsigned used : 1;
275 unsigned type : TYPE_BITS; 275 unsigned type : TYPE_BITS;
276 unsigned flags : FLAG_BITS; 276 unsigned flags : FLAG_BITS;
277 unsigned char sha1[20]; 277 unsigned char sha1[20];
278}; 278};
279 279
280 280
281/** Returns the object, having parsed it to find out what it is. **/
282struct object *parse_object(const unsigned char *sha1);
283
284
281/* 285/*
282 * from git:tree.h 286 * from git:tree.h
283 */ 287 */
284 288
285struct tree { 289struct tree {
286 struct object object; 290 struct object object;
287 void *buffer; 291 void *buffer;
288 unsigned long size; 292 unsigned long size;
289}; 293};
290 294
291 295
292struct tree *lookup_tree(const unsigned char *sha1); 296struct tree *lookup_tree(const unsigned char *sha1);
293int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size); 297int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size);
294int parse_tree(struct tree *tree); 298int parse_tree(struct tree *tree);
295struct tree *parse_tree_indirect(const unsigned char *sha1); 299struct tree *parse_tree_indirect(const unsigned char *sha1);
296 300
297typedef int (*read_tree_fn_t)(const unsigned char *, const char *, int, const char *, unsigned int, int); 301typedef int (*read_tree_fn_t)(const unsigned char *, const char *, int, const char *, unsigned int, int);
298 302
299extern int read_tree_recursive(struct tree *tree, 303extern int read_tree_recursive(struct tree *tree,
300 const char *base, int baselen, 304 const char *base, int baselen,
301 int stage, const char **match, 305 int stage, const char **match,
302 read_tree_fn_t fn); 306 read_tree_fn_t fn);
303 307
304extern int read_tree(struct tree *tree, int stage, const char **paths); 308extern int read_tree(struct tree *tree, int stage, const char **paths);
305 309
306 310
307/* from git:commit.h */ 311/* from git:commit.h */
308 312
309struct commit_list { 313struct commit_list {
310 struct commit *item; 314 struct commit *item;
311 struct commit_list *next; 315 struct commit_list *next;
312}; 316};
313 317
314struct commit { 318struct commit {
315 struct object object; 319 struct object object;
316 void *util; 320 void *util;
317 unsigned long date; 321 unsigned long date;
318 struct commit_list *parents; 322 struct commit_list *parents;
319 struct tree *tree; 323 struct tree *tree;
320 char *buffer; 324 char *buffer;
321}; 325};
322 326
323 327
324struct commit *lookup_commit(const unsigned char *sha1); 328struct commit *lookup_commit(const unsigned char *sha1);
325struct commit *lookup_commit_reference(const unsigned char *sha1); 329struct commit *lookup_commit_reference(const unsigned char *sha1);
326struct commit *lookup_commit_reference_gently(const unsigned char *sha1, 330struct commit *lookup_commit_reference_gently(const unsigned char *sha1,
327 int quiet); 331 int quiet);
328 332
329int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size); 333int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size);
330int parse_commit(struct commit *item); 334int parse_commit(struct commit *item);
331 335
332struct commit_list * commit_list_insert(struct commit *item, struct commit_list **list_p); 336struct commit_list * commit_list_insert(struct commit *item, struct commit_list **list_p);
333struct commit_list * insert_by_date(struct commit *item, struct commit_list **list); 337struct commit_list * insert_by_date(struct commit *item, struct commit_list **list);
334 338
335void free_commit_list(struct commit_list *list); 339void free_commit_list(struct commit_list *list);
336 340
337void sort_by_date(struct commit_list **list); 341void sort_by_date(struct commit_list **list);
338 342
339/* Commit formats */ 343/* Commit formats */
340enum cmit_fmt { 344enum cmit_fmt {
341 CMIT_FMT_RAW, 345 CMIT_FMT_RAW,
342 CMIT_FMT_MEDIUM, 346 CMIT_FMT_MEDIUM,
343 CMIT_FMT_DEFAULT = CMIT_FMT_MEDIUM, 347 CMIT_FMT_DEFAULT = CMIT_FMT_MEDIUM,
344 CMIT_FMT_SHORT, 348 CMIT_FMT_SHORT,
345 CMIT_FMT_FULL, 349 CMIT_FMT_FULL,
346 CMIT_FMT_FULLER, 350 CMIT_FMT_FULLER,
347 CMIT_FMT_ONELINE, 351 CMIT_FMT_ONELINE,
348 CMIT_FMT_EMAIL, 352 CMIT_FMT_EMAIL,
349 353
350 CMIT_FMT_UNSPECIFIED, 354 CMIT_FMT_UNSPECIFIED,
351}; 355};
352 356
353extern 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); 357extern 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);
354 358
355 359
356typedef void (*topo_sort_set_fn_t)(struct commit*, void *data); 360typedef void (*topo_sort_set_fn_t)(struct commit*, void *data);
357typedef void* (*topo_sort_get_fn_t)(struct commit*); 361typedef void* (*topo_sort_get_fn_t)(struct commit*);
358 362
359 363
360 364
361/* 365/*
362 * from git:tag.h 366 * from git:tag.h
363 */ 367 */
364 368
365extern const char *tag_type; 369extern const char *tag_type;
366 370
367struct tag { 371struct tag {
368 struct object object; 372 struct object object;
369 struct object *tagged; 373 struct object *tagged;
370 char *tag; 374 char *tag;
371 char *signature; /* not actually implemented */ 375 char *signature; /* not actually implemented */
372}; 376};
373 377
374extern struct tag *lookup_tag(const unsigned char *sha1); 378extern struct tag *lookup_tag(const unsigned char *sha1);
375extern int parse_tag_buffer(struct tag *item, void *data, unsigned long size); 379extern int parse_tag_buffer(struct tag *item, void *data, unsigned long size);
376extern int parse_tag(struct tag *item); 380extern int parse_tag(struct tag *item);