merge-recursive: always roll back lock in merge_recursive_generic()
If we return early, or if `active_cache_changed` is false, we forget to roll back the lockfile. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
6481652432
commit
51d3f43d2f
@ -2218,12 +2218,15 @@ int merge_recursive_generic(struct merge_options *o,
|
|||||||
hold_locked_index(&lock, LOCK_DIE_ON_ERROR);
|
hold_locked_index(&lock, LOCK_DIE_ON_ERROR);
|
||||||
clean = merge_recursive(o, head_commit, next_commit, ca,
|
clean = merge_recursive(o, head_commit, next_commit, ca,
|
||||||
result);
|
result);
|
||||||
if (clean < 0)
|
if (clean < 0) {
|
||||||
|
rollback_lock_file(&lock);
|
||||||
return clean;
|
return clean;
|
||||||
|
}
|
||||||
|
|
||||||
if (active_cache_changed &&
|
if (active_cache_changed &&
|
||||||
write_locked_index(&the_index, &lock, COMMIT_LOCK))
|
write_locked_index(&the_index, &lock, COMMIT_LOCK))
|
||||||
return err(o, _("Unable to write index."));
|
return err(o, _("Unable to write index."));
|
||||||
|
rollback_lock_file(&lock);
|
||||||
|
|
||||||
return clean ? 0 : 1;
|
return clean ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user