summaryrefslogtreecommitdiff
path: root/update-index.c
diff options
context:
space:
mode:
Diffstat (limited to 'update-index.c')
-rw-r--r--update-index.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/update-index.c b/update-index.c
index ade1ee7..b825a11 100644
--- a/update-index.c
+++ b/update-index.c
@@ -391,9 +391,11 @@ int main(int argc, const char **argv)
update_one(buf.buf, prefix, prefix_length);
}
}
- if (write_cache(newfd, active_cache, active_nr) ||
- commit_index_file(&cache_file))
- die("Unable to write new cachefile");
+ if (active_cache_changed) {
+ if (write_cache(newfd, active_cache, active_nr) ||
+ commit_index_file(&cache_file))
+ die("Unable to write new cachefile");
+ }
return has_errors ? 1 : 0;
}