1/* 2 * Copyright (C) 2005 Junio C Hamano 3 */ 4#ifndef _DIFFCORE_H_ 5#define _DIFFCORE_H_ 6 7/* This header file is internal between diff.c and its diff transformers 8 * (e.g. diffcore-rename, diffcore-pickaxe). Never include this header 9 * in anything else. 10 */ 11#define MAX_SCORE 10000 12#define DEFAULT_MINIMUM_SCORE 5000 13 14#define RENAME_DST_MATCHED 01 15 16struct diff_filespec { 17unsigned char sha1[20]; 18char*path; 19void*data; 20unsigned long size; 21int xfrm_flags;/* for use by the xfrm */ 22unsigned short mode;/* file mode */ 23unsigned sha1_valid :1;/* if true, use sha1 and trust mode; 24 * if false, use the name and read from 25 * the filesystem. 26 */ 27#define DIFF_FILE_VALID(spec) (((spec)->mode) != 0) 28unsigned should_free :1;/* data should be free()'ed */ 29unsigned should_munmap :1;/* data should be munmap()'ed */ 30}; 31 32externstruct diff_filespec *alloc_filespec(const char*); 33externvoidfill_filespec(struct diff_filespec *,const unsigned char*, 34unsigned short); 35 36externintdiff_populate_filespec(struct diff_filespec *); 37externvoiddiff_free_filespec_data(struct diff_filespec *); 38 39struct diff_filepair { 40struct diff_filespec *one; 41struct diff_filespec *two; 42int score;/* only valid when one and two are different paths */ 43int orig_order;/* the original order of insertion into the queue */ 44int rename_rank;/* rename/copy dependency needs to enforce 45 * certain ordering of patches that later 46 * diffcore transformations should not break. 47 */ 48int status;/* M C R N D U (see Documentation/diff-format.txt) */ 49}; 50#define DIFF_PAIR_UNMERGED(p) \ 51 (!DIFF_FILE_VALID((p)->one) && !DIFF_FILE_VALID((p)->two)) 52 53externintdiff_unmodified_pair(struct diff_filepair *); 54 55struct diff_queue_struct { 56struct diff_filepair **queue; 57int alloc; 58int nr; 59}; 60 61externstruct diff_queue_struct diff_queued_diff; 62externstruct diff_filepair *diff_queue(struct diff_queue_struct *, 63struct diff_filespec *, 64struct diff_filespec *); 65externvoiddiff_q(struct diff_queue_struct *,struct diff_filepair *); 66 67externintdiff_needs_to_stay(struct diff_queue_struct *,int, 68struct diff_filespec *); 69 70#endif