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>
Nguyễn Thái Ngọc Duy committed
Apr 28, 2014 at 17:55 UTC
33c297aacc0ce0f945198fbcdf48fbf2fd27d01b
1 file changed
+1
-1
sequencer.c
+1
-1
@@ -679,7 +679,7 @@ static void read_and_refresh_cache(struct replay_opts *opts)
679
if (read_index_preload(&the_index, NULL) < 0)
680
die(_("git %s: failed to read the index"), action_name(opts));
681
refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL);
682
- if (the_index.cache_changed) {
682
+ if (the_index.cache_changed && index_fd >= 0) {
683
if (write_index(&the_index, index_fd) ||
684
commit_locked_index(&index_lock))
685
die(_("git %s: failed to refresh the index"), action_name(opts));