summaryrefslogtreecommitdiff
path: root/builtin-commit.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2007-11-09 16:40:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-11-23 01:05:03 (GMT)
commitd37d320386369375b4e5b95b98517503125376f9 (patch)
tree63b3b6035e62dc91f80166f412b4d06b367b7da2 /builtin-commit.c
parent741707b1e2261d522a92948ff7d7b897ff00e587 (diff)
downloadgit-d37d320386369375b4e5b95b98517503125376f9.zip
git-d37d320386369375b4e5b95b98517503125376f9.tar.gz
git-d37d320386369375b4e5b95b98517503125376f9.tar.bz2
builtin-commit: Refresh cache after adding files.
We have promised our users that after running git-status or git-commit the index will be refreshed for a long time since these commands were introduced. Do refresh the index before writing it out to keep the promise. Signed-off-by: Kristian Høgsberg <krh@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-commit.c')
-rw-r--r--builtin-commit.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin-commit.c b/builtin-commit.c
index c8f79a8..a84a729 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -81,6 +81,7 @@ static char *prepare_index(const char **files, const char *prefix)
if (all || also) {
add_files_to_cache(verbose, also ? prefix : NULL, files);
+ refresh_cache(REFRESH_QUIET);
if (write_cache(fd, active_cache, active_nr) || close(fd))
die("unable to write new_index file");
return lock_file.filename;
@@ -110,6 +111,7 @@ static char *prepare_index(const char **files, const char *prefix)
fd = hold_lock_file_for_update(next_index_lock,
git_path("next-index-%d", getpid()), 1);
add_files_to_cache(verbose, prefix, files);
+ refresh_cache(REFRESH_QUIET);
if (write_cache(fd, active_cache, active_nr) || close(fd))
die("unable to write new_index file");