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#define RENAME_SRC_GONE 02 16#define RENAME_SCORE_SHIFT 8 17 18struct diff_filespec { 19unsigned char sha1[20]; 20char*path; 21void*data; 22unsigned long size; 23int xfrm_flags;/* for use by the xfrm */ 24unsigned short mode;/* file mode */ 25unsigned sha1_valid :1;/* if true, use sha1 and trust mode; 26 * if false, use the name and read from 27 * the filesystem. 28 */ 29unsigned file_valid :1;/* if false the file does not exist */ 30unsigned should_free :1;/* data should be free()'ed */ 31unsigned should_munmap :1;/* data should be munmap()'ed */ 32}; 33 34externstruct diff_filespec *alloc_filespec(const char*); 35externvoidfill_filespec(struct diff_filespec *,const unsigned char*, 36unsigned short); 37 38externintdiff_populate_filespec(struct diff_filespec *); 39externvoiddiff_free_filespec_data(struct diff_filespec *); 40 41struct diff_filepair { 42struct diff_filespec *one; 43struct diff_filespec *two; 44char*xfrm_msg; 45int orig_order;/* the original order of insertion into the queue */ 46int xfrm_work;/* for use by tramsformers, not by diffcore */ 47}; 48 49struct diff_queue_struct { 50struct diff_filepair **queue; 51int alloc; 52int nr; 53}; 54 55externstruct diff_filepair *diff_queue(struct diff_queue_struct *, 56struct diff_filespec *, 57struct diff_filespec *); 58externvoiddiff_detect_rename(struct diff_queue_struct *,int,int); 59externvoiddiff_pickaxe(struct diff_queue_struct *,const char*); 60 61#endif