summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2014-04-28 17:55:24 +0700
committerJunio C Hamano <gitster@pobox.com>2014-04-29 12:43:16 -0700
commit33c297aacc0ce0f945198fbcdf48fbf2fd27d01b (patch)
treed3e1f7c739d0b2ba9343dc1c8bb95d2a8123c9d1
parent16fc2b7a9ca54b12b06bb3d677db65e5e64638c5 (diff)
downloadgit-33c297aacc0ce0f945198fbcdf48fbf2fd27d01b.tar.gz
sequencer: do not update/refresh index if the lock cannot be held
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--sequencer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sequencer.c b/sequencer.c
index bde5f047b0..7b886a67dd 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -679,7 +679,7 @@ static void read_and_refresh_cache(struct replay_opts *opts)
if (read_index_preload(&the_index, NULL) < 0)
die(_("git %s: failed to read the index"), action_name(opts));
refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL);
- if (the_index.cache_changed) {
+ if (the_index.cache_changed && index_fd >= 0) {
if (write_index(&the_index, index_fd) ||
commit_locked_index(&index_lock))
die(_("git %s: failed to refresh the index"), action_name(opts));