read-cache: new API write_locked_index instead of write_index/write_cache

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy
2014-06-13 19:19:23 +07:00
committed by Junio C Hamano
parent 33c297aacc
commit 03b8664772
20 changed files with 86 additions and 93 deletions

View File

@ -1986,7 +1986,7 @@ int merge_recursive_generic(struct merge_options *o,
const unsigned char **base_list,
struct commit **result)
{
int clean, index_fd;
int clean;
struct lock_file *lock = xcalloc(1, sizeof(struct lock_file));
struct commit *head_commit = get_ref(head, o->branch1);
struct commit *next_commit = get_ref(merge, o->branch2);
@ -2003,12 +2003,11 @@ int merge_recursive_generic(struct merge_options *o,
}
}
index_fd = hold_locked_index(lock, 1);
hold_locked_index(lock, 1);
clean = merge_recursive(o, head_commit, next_commit, ca,
result);
if (active_cache_changed &&
(write_cache(index_fd, active_cache, active_nr) ||
commit_locked_index(lock)))
write_locked_index(&the_index, lock, COMMIT_LOCK))
return error(_("Unable to write index."));
return clean ? 0 : 1;