From: Junio C Hamano Date: Wed, 14 Nov 2007 22:15:40 +0000 (-0800) Subject: Merge branch 'jc/maint-add-sync-stat' X-Git-Tag: v1.5.4-rc0~207 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c78a24986d4d3faff810e87dbcd0ac99f0eabbce;p=git.git Merge branch 'jc/maint-add-sync-stat' * jc/maint-add-sync-stat: t2200: test more cases of "add -u" git-add: make the entry stat-clean after re-adding the same contents ce_match_stat, run_diff_files: use symbolic constants for readability Conflicts: builtin-add.c --- c78a24986d4d3faff810e87dbcd0ac99f0eabbce diff --cc builtin-add.c index 45b14e8a6,e072320d2..77dcde693 --- a/builtin-add.c +++ b/builtin-add.c @@@ -120,7 -121,9 +120,7 @@@ void add_files_to_cache(int verbose, co rev.diffopt.output_format = DIFF_FORMAT_CALLBACK; rev.diffopt.format_callback = update_callback; rev.diffopt.format_callback_data = &verbose; - run_diff_files(&rev, 0); - if (read_cache() < 0) - die("index file corrupt"); + run_diff_files(&rev, DIFF_RACY_IS_MODIFIED); } static void refresh(int verbose, const char **pathspec) diff --cc cache.h index f0a25c7ff,31af16a7e..f4f27cd70 --- a/cache.h +++ b/cache.h @@@ -268,10 -266,17 +268,16 @@@ extern int remove_file_from_index(struc extern int add_file_to_index(struct index_state *, const char *path, int verbose); extern struct cache_entry *make_cache_entry(unsigned int mode, const unsigned char *sha1, const char *path, int stage, int refresh); extern int ce_same_name(struct cache_entry *a, struct cache_entry *b); - extern int ie_match_stat(struct index_state *, struct cache_entry *, struct stat *, int); - extern int ie_modified(struct index_state *, struct cache_entry *, struct stat *, int); + + /* do stat comparison even if CE_VALID is true */ + #define CE_MATCH_IGNORE_VALID 01 + /* do not check the contents but report dirty on racily-clean entries */ + #define CE_MATCH_RACY_IS_DIRTY 02 + extern int ie_match_stat(struct index_state *, struct cache_entry *, struct stat *, unsigned int); + extern int ie_modified(struct index_state *, struct cache_entry *, struct stat *, unsigned int); + extern int ce_path_match(const struct cache_entry *ce, const char **pathspec); extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, enum object_type type, const char *path); -extern int read_fd(int fd, char **return_buf, unsigned long *return_size); extern int index_pipe(unsigned char *sha1, int fd, const char *type, int write_object); extern int index_path(unsigned char *sha1, const char *path, struct stat *st, int write_object); extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);