Skip to content

Commit

Permalink
builtin-commit: Refresh cache after adding files.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kristian Høgsberg authored and Junio C Hamano committed Nov 23, 2007
1 parent 741707b commit d37d320
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions builtin-commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");

Expand Down

0 comments on commit d37d320

Please sign in to comment.