Skip to content

Commit 51d3f43

Browse files
Martin Ågrengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6481652 commit 51d3f43

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

merge-recursive.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2218,12 +2218,15 @@ int merge_recursive_generic(struct merge_options *o,
22182218
hold_locked_index(&lock, LOCK_DIE_ON_ERROR);
22192219
clean = merge_recursive(o, head_commit, next_commit, ca,
22202220
result);
2221-
if (clean < 0)
2221+
if (clean < 0) {
2222+
rollback_lock_file(&lock);
22222223
return clean;
2224+
}
22232225

22242226
if (active_cache_changed &&
22252227
write_locked_index(&the_index, &lock, COMMIT_LOCK))
22262228
return err(o, _("Unable to write index."));
2229+
rollback_lock_file(&lock);
22272230

22282231
return clean ? 0 : 1;
22292232
}

0 commit comments

Comments
 (0)