diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-01-20 20:25:11 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-01-20 20:25:11 -0800 |
commit | 8f376a50ec6a125d4ac6786688cbfa5340dd59c0 (patch) | |
tree | ad466675c40734d8960b6ad9565ec52aedc704e6 | |
parent | 9504f3d3d2e62cb6fba9e7c61c6fe69dec9053a4 (diff) | |
parent | ab6854515ee2280f187fbc2ab08f9e9115438f3e (diff) | |
download | git-8f376a50ec6a125d4ac6786688cbfa5340dd59c0.tar.gz |
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
-rw-r--r-- | builtin-commit.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/builtin-commit.c b/builtin-commit.c index 33aa593c21..83b7c353ed 100644 --- a/builtin-commit.c +++ b/builtin-commit.c @@ -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(); } |