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>
Kristian Høgsberg committed
Nov 9, 2007 at 11:40 UTC
d37d320386369375b4e5b95b98517503125376f9
1 file changed
+2
builtin-commit.c
+2
@@ -81,6 +81,7 @@ static char *prepare_index(const char **files, const char *prefix)
81
82
if (all || also) {
83
add_files_to_cache(verbose, also ? prefix : NULL, files);
84
+ refresh_cache(REFRESH_QUIET);
85
if (write_cache(fd, active_cache, active_nr) || close(fd))
86
die("unable to write new_index file");
87
return lock_file.filename;
@@ -110,6 +111,7 @@ static char *prepare_index(const char **files, const char *prefix)
111
fd = hold_lock_file_for_update(next_index_lock,
112
git_path("next-index-%d", getpid()), 1);
113
add_files_to_cache(verbose, prefix, files);
114
+ refresh_cache(REFRESH_QUIET);
115
if (write_cache(fd, active_cache, active_nr) || close(fd))
116
die("unable to write new_index file");
117