summaryrefslogtreecommitdiff
path: root/builtin-update-index.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin-update-index.c')
-rw-r--r--builtin-update-index.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/builtin-update-index.c b/builtin-update-index.c
index 509369e9e7..a7a4574f2b 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);