From: Junio C Hamano Date: Tue, 11 Jun 2013 20:30:05 +0000 (-0700) Subject: Merge branch 'rs/unpack-trees-plug-leak' X-Git-Tag: v1.8.4-rc0~195 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/dd261b1727e4c251e761b45295c00d1cfcf52b8b?hp=-c Merge branch 'rs/unpack-trees-plug-leak' * rs/unpack-trees-plug-leak: unpack-trees: free cache_entry array members for merges diff-lib, read-tree, unpack-trees: mark cache_entry array paramters const diff-lib, read-tree, unpack-trees: mark cache_entry pointers const unpack-trees: create working copy of merge entry in merged_entry unpack-trees: factor out dup_entry read-cache: mark cache_entry pointers const cache: mark cache_entry pointers const --- dd261b1727e4c251e761b45295c00d1cfcf52b8b diff --combined cache.h index df532f8e4a,01e8760ecf..820aa05c7a --- a/cache.h +++ b/cache.h @@@ -190,7 -190,8 +190,8 @@@ struct cache_entry * another. But we never change the name, or the hash state! */ #define CE_STATE_MASK (CE_HASHED | CE_UNHASHED) - static inline void copy_cache_entry(struct cache_entry *dst, struct cache_entry *src) + static inline void copy_cache_entry(struct cache_entry *dst, + const struct cache_entry *src) { unsigned int state = dst->ce_flags & CE_STATE_MASK; @@@ -222,7 -223,8 +223,8 @@@ static inline unsigned int create_ce_mo return S_IFGITLINK; return S_IFREG | ce_permissions(mode); } - static inline unsigned int ce_mode_from_stat(struct cache_entry *ce, unsigned int mode) + static inline unsigned int ce_mode_from_stat(const struct cache_entry *ce, + unsigned int mode) { extern int trust_executable_bit, has_symlinks; if (!has_symlinks && S_ISREG(mode) && @@@ -480,8 -482,8 +482,8 @@@ extern void *read_blob_data_from_index( #define CE_MATCH_RACY_IS_DIRTY 02 /* do stat comparison even if CE_SKIP_WORKTREE is true */ #define CE_MATCH_IGNORE_SKIP_WORKTREE 04 - extern int ie_match_stat(const struct index_state *, struct cache_entry *, struct stat *, unsigned int); - extern int ie_modified(const struct index_state *, struct cache_entry *, struct stat *, unsigned int); + extern int ie_match_stat(const struct index_state *, const struct cache_entry *, struct stat *, unsigned int); + extern int ie_modified(const struct index_state *, const struct cache_entry *, struct stat *, unsigned int); #define PATHSPEC_ONESTAR 1 /* the pathspec pattern sastisfies GFNM_ONESTAR */ @@@ -910,7 -912,6 +912,7 @@@ void show_date_relative(unsigned long t struct strbuf *timebuf); int parse_date(const char *date, char *buf, int bufsize); int parse_date_basic(const char *date, unsigned long *timestamp, int *offset); +int parse_expiry_date(const char *date, unsigned long *timestamp); void datestamp(char *buf, int bufsize); #define approxidate(s) approxidate_careful((s), NULL) unsigned long approxidate_careful(const char *, int *); @@@ -1025,21 -1026,9 +1027,21 @@@ struct ref unsigned int force:1, forced_update:1, - merge:1, deletion:1, matched:1; + + /* + * Order is important here, as we write to FETCH_HEAD + * in numeric order. And the default NOT_FOR_MERGE + * should be 0, so that xcalloc'd structures get it + * by default. + */ + enum { + FETCH_HEAD_MERGE = -1, + FETCH_HEAD_NOT_FOR_MERGE = 0, + FETCH_HEAD_IGNORE = 1 + } fetch_head_status; + enum { REF_STATUS_NONE = 0, REF_STATUS_OK,