1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-10-30 22:07:53 +01:00

Merge branch 'jc/maint-refresh-index-is-optional-for-status' into maint

* jc/maint-refresh-index-is-optional-for-status:
  status: don't require the repository to be writable
This commit is contained in:
Junio C Hamano 2010-01-20 20:25:11 -08:00
commit 8f376a50ec

View file

@ -278,11 +278,13 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
* We still need to refresh the index here.
*/
if (!pathspec || !*pathspec) {
fd = hold_locked_index(&index_lock, 1);
fd = hold_locked_index(&index_lock, !is_status);
refresh_cache(refresh_flags);
if (write_cache(fd, active_cache, active_nr) ||
commit_locked_index(&index_lock))
die("unable to write new_index file");
if (0 <= fd) {
if (write_cache(fd, active_cache, active_nr) ||
commit_locked_index(&index_lock))
die("unable to write new_index file");
}
commit_style = COMMIT_AS_IS;
return get_index_file();
}