diff options
Diffstat (limited to 'git.h')
| -rw-r--r-- | git.h | 106 |
1 files changed, 106 insertions, 0 deletions
| @@ -128,6 +128,8 @@ static inline ssize_t xwrite(int fd, const void *buf, size_t len) | |||
| 128 | #define MINIMUM_ABBREV 4 | 128 | #define MINIMUM_ABBREV 4 |
| 129 | #define DEFAULT_ABBREV 7 | 129 | #define DEFAULT_ABBREV 7 |
| 130 | 130 | ||
| 131 | extern const unsigned char null_sha1[20]; | ||
| 132 | |||
| 131 | extern int sha1_object_info(const unsigned char *, char *, unsigned long *); | 133 | extern int sha1_object_info(const unsigned char *, char *, unsigned long *); |
| 132 | 134 | ||
| 133 | extern void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size); | 135 | extern void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size); |
| @@ -136,6 +138,24 @@ extern int get_sha1(const char *str, unsigned char *sha1); | |||
| 136 | extern int get_sha1_hex(const char *hex, unsigned char *sha1); | 138 | extern int get_sha1_hex(const char *hex, unsigned char *sha1); |
| 137 | extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */ | 139 | extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */ |
| 138 | 140 | ||
| 141 | static inline int is_null_sha1(const unsigned char *sha1) | ||
| 142 | { | ||
| 143 | return !memcmp(sha1, null_sha1, 20); | ||
| 144 | } | ||
| 145 | static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2) | ||
| 146 | { | ||
| 147 | return memcmp(sha1, sha2, 20); | ||
| 148 | } | ||
| 149 | static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src) | ||
| 150 | { | ||
| 151 | memcpy(sha_dst, sha_src, 20); | ||
| 152 | } | ||
| 153 | static inline void hashclr(unsigned char *hash) | ||
| 154 | { | ||
| 155 | memset(hash, 0, 20); | ||
| 156 | } | ||
| 157 | |||
| 158 | |||
| 139 | 159 | ||
| 140 | 160 | ||
| 141 | /* | 161 | /* |
| @@ -257,6 +277,61 @@ typedef void* (*topo_sort_get_fn_t)(struct commit*); | |||
| 257 | 277 | ||
| 258 | 278 | ||
| 259 | 279 | ||
| 280 | /* | ||
| 281 | * from git:diffcore.h | ||
| 282 | */ | ||
| 283 | |||
| 284 | struct diff_filespec { | ||
| 285 | unsigned char sha1[20]; | ||
| 286 | char *path; | ||
| 287 | void *data; | ||
| 288 | void *cnt_data; | ||
| 289 | unsigned long size; | ||
| 290 | int xfrm_flags; /* for use by the xfrm */ | ||
| 291 | unsigned short mode; /* file mode */ | ||
| 292 | unsigned sha1_valid : 1; /* if true, use sha1 and trust mode; | ||
| 293 | * if false, use the name and read from | ||
| 294 | * the filesystem. | ||
| 295 | */ | ||
| 296 | #define DIFF_FILE_VALID(spec) (((spec)->mode) != 0) | ||
| 297 | unsigned should_free : 1; /* data should be free()'ed */ | ||
| 298 | unsigned should_munmap : 1; /* data should be munmap()'ed */ | ||
| 299 | }; | ||
| 300 | |||
| 301 | struct diff_filepair { | ||
| 302 | struct diff_filespec *one; | ||
| 303 | struct diff_filespec *two; | ||
| 304 | unsigned short int score; | ||
| 305 | char status; /* M C R N D U (see Documentation/diff-format.txt) */ | ||
| 306 | unsigned source_stays : 1; /* all of R/C are copies */ | ||
| 307 | unsigned broken_pair : 1; | ||
| 308 | unsigned renamed_pair : 1; | ||
| 309 | }; | ||
| 310 | |||
| 311 | #define DIFF_PAIR_UNMERGED(p) \ | ||
| 312 | (!DIFF_FILE_VALID((p)->one) && !DIFF_FILE_VALID((p)->two)) | ||
| 313 | |||
| 314 | #define DIFF_PAIR_RENAME(p) ((p)->renamed_pair) | ||
| 315 | |||
| 316 | #define DIFF_PAIR_BROKEN(p) \ | ||
| 317 | ( (!DIFF_FILE_VALID((p)->one) != !DIFF_FILE_VALID((p)->two)) && \ | ||
| 318 | ((p)->broken_pair != 0) ) | ||
| 319 | |||
| 320 | #define DIFF_PAIR_TYPE_CHANGED(p) \ | ||
| 321 | ((S_IFMT & (p)->one->mode) != (S_IFMT & (p)->two->mode)) | ||
| 322 | |||
| 323 | #define DIFF_PAIR_MODE_CHANGED(p) ((p)->one->mode != (p)->two->mode) | ||
| 324 | |||
| 325 | extern void diff_free_filepair(struct diff_filepair *); | ||
| 326 | |||
| 327 | extern int diff_unmodified_pair(struct diff_filepair *); | ||
| 328 | |||
| 329 | struct diff_queue_struct { | ||
| 330 | struct diff_filepair **queue; | ||
| 331 | int alloc; | ||
| 332 | int nr; | ||
| 333 | }; | ||
| 334 | |||
| 260 | 335 | ||
| 261 | /* | 336 | /* |
| 262 | * from git:diff.h | 337 | * from git:diff.h |
| @@ -352,6 +427,32 @@ enum color_diff { | |||
| 352 | }; | 427 | }; |
| 353 | 428 | ||
| 354 | 429 | ||
| 430 | extern int diff_tree_sha1(const unsigned char *old, const unsigned char *new, | ||
| 431 | const char *base, struct diff_options *opt); | ||
| 432 | |||
| 433 | extern int diff_root_tree_sha1(const unsigned char *new, const char *base, | ||
| 434 | struct diff_options *opt); | ||
| 435 | |||
| 436 | extern int git_diff_ui_config(const char *var, const char *value); | ||
| 437 | extern void diff_setup(struct diff_options *); | ||
| 438 | extern int diff_opt_parse(struct diff_options *, const char **, int); | ||
| 439 | extern int diff_setup_done(struct diff_options *); | ||
| 440 | |||
| 441 | |||
| 442 | extern void diffcore_std(struct diff_options *); | ||
| 443 | extern void diff_flush(struct diff_options*); | ||
| 444 | |||
| 445 | |||
| 446 | /* diff-raw status letters */ | ||
| 447 | #define DIFF_STATUS_ADDED 'A' | ||
| 448 | #define DIFF_STATUS_COPIED 'C' | ||
| 449 | #define DIFF_STATUS_DELETED 'D' | ||
| 450 | #define DIFF_STATUS_MODIFIED 'M' | ||
| 451 | #define DIFF_STATUS_RENAMED 'R' | ||
| 452 | #define DIFF_STATUS_TYPE_CHANGED 'T' | ||
| 453 | #define DIFF_STATUS_UNKNOWN 'X' | ||
| 454 | #define DIFF_STATUS_UNMERGED 'U' | ||
| 455 | |||
| 355 | 456 | ||
| 356 | 457 | ||
| 357 | /* | 458 | /* |
| @@ -458,5 +559,10 @@ extern struct commit *get_revision(struct rev_info *revs); | |||
| 458 | 559 | ||
| 459 | 560 | ||
| 460 | 561 | ||
| 562 | /* from git:log-tree.h */ | ||
| 563 | |||
| 564 | int log_tree_commit(struct rev_info *, struct commit *); | ||
| 565 | |||
| 566 | |||
| 461 | 567 | ||
| 462 | #endif /* GIT_H */ | 568 | #endif /* GIT_H */ |
