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

@ -616,7 +616,7 @@ static int checkout(void)
struct unpack_trees_options opts;
struct tree *tree;
struct tree_desc t;
int err = 0, fd;
int err = 0;
if (option_no_checkout)
return 0;
@ -640,7 +640,7 @@ static int checkout(void)
setup_work_tree();
lock_file = xcalloc(1, sizeof(struct lock_file));
fd = hold_locked_index(lock_file, 1);
hold_locked_index(lock_file, 1);
memset(&opts, 0, sizeof opts);
opts.update = 1;
@ -656,8 +656,7 @@ static int checkout(void)
if (unpack_trees(1, &t, &opts) < 0)
die(_("unable to checkout working tree"));
if (write_cache(fd, active_cache, active_nr) ||
commit_locked_index(lock_file))
if (write_locked_index(&the_index, lock_file, COMMIT_LOCK))
die(_("unable to write new index file"));
err |= run_hook_le(NULL, "post-checkout", sha1_to_hex(null_sha1),