summaryrefslogtreecommitdiff
path: root/update-index.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2005-10-01 20:39:47 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-10-02 06:56:16 (GMT)
commit5cd5ace72bf8944c920a20a7b98c82f7ed663d8a (patch)
treebdf8f047c166f588403414c2c7b807ceefc92338 /update-index.c
parent5d1a5c02e8ac1c16688ea4a44512245f25a49f8a (diff)
downloadgit-5cd5ace72bf8944c920a20a7b98c82f7ed663d8a.zip
git-5cd5ace72bf8944c920a20a7b98c82f7ed663d8a.tar.gz
git-5cd5ace72bf8944c920a20a7b98c82f7ed663d8a.tar.bz2
[PATCH] Re-instate index file write optimization
This makes "git-update-index" avoid the new index file write if it didn't make any changes to the index. It still doesn't make things like "git status" be read-only operations in general, but if the index file doesn't need refreshing, it now will at least avoid making unnecessary changes. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
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;
}