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:
committed by
Junio C Hamano
parent
33c297aacc
commit
03b8664772
@ -99,7 +99,7 @@ static struct lock_file lock_file;
|
||||
|
||||
int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
|
||||
{
|
||||
int i, newfd, stage = 0;
|
||||
int i, stage = 0;
|
||||
unsigned char sha1[20];
|
||||
struct tree_desc t[MAX_UNPACK_TREES];
|
||||
struct unpack_trees_options opts;
|
||||
@ -149,7 +149,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
|
||||
argc = parse_options(argc, argv, unused_prefix, read_tree_options,
|
||||
read_tree_usage, 0);
|
||||
|
||||
newfd = hold_locked_index(&lock_file, 1);
|
||||
hold_locked_index(&lock_file, 1);
|
||||
|
||||
prefix_set = opts.prefix ? 1 : 0;
|
||||
if (1 < opts.merge + opts.reset + prefix_set)
|
||||
@ -233,8 +233,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
|
||||
if (nr_trees == 1 && !opts.prefix)
|
||||
prime_cache_tree(&active_cache_tree, trees[0]);
|
||||
|
||||
if (write_cache(newfd, 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");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user