X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-update-index.c;h=a7a4574f2bff2a7db4a1c25aa4a514ad99760381;hb=5433235daec11550973f1e290f069ce0c27f53ab;hp=509369e9e7b1719e53ba2dd2d976066fb9513353;hpb=a6954452ecf757523b31d6eaaf7e00c7a2d91e46;p=git.git diff --git a/builtin-update-index.c b/builtin-update-index.c index 509369e9e..a7a4574f2 100644 --- a/builtin-update-index.c +++ b/builtin-update-index.c @@ -86,9 +86,15 @@ static int process_lstat_error(const char *path, int err) static int add_one_path(struct cache_entry *old, const char *path, int len, struct stat *st) { - int option, size = cache_entry_size(len); - struct cache_entry *ce = xcalloc(1, size); + int option, size; + struct cache_entry *ce; + + /* Was the old index entry already up-to-date? */ + if (old && !ce_stage(old) && !ce_match_stat(old, st, 0)) + return 0; + size = cache_entry_size(len); + ce = xcalloc(1, size); memcpy(ce->name, path, len); ce->ce_flags = htons(len); fill_stat_cache_info(ce, st);