X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-read-tree.c;h=c1867d2a0052ad797481f3d5f9aa544952ff251b;hb=a2a3bf7b2baf0ff64c5b5ffc78d54be82d9967f1;hp=8869cedea1f9b07d78520858876cca614283d01b;hpb=076b0adcf9dac7bd9d18624087f679cc811aeb77;p=git.git diff --git a/builtin-read-tree.c b/builtin-read-tree.c index 8869cedea..c1867d2a0 100644 --- a/builtin-read-tree.c +++ b/builtin-read-tree.c @@ -12,7 +12,7 @@ #include "unpack-trees.h" #include "builtin.h" -static struct object_list *trees = NULL; +static struct object_list *trees; static int list_tree(unsigned char *sha1) { @@ -53,7 +53,7 @@ static void prime_cache_tree_rec(struct cache_tree *it, struct tree *tree) struct name_entry entry; int cnt; - memcpy(it->sha1, tree->object.sha1, 20); + hashcpy(it->sha1, tree->object.sha1); desc.buf = tree->buffer; desc.size = tree->size; cnt = 0; @@ -88,7 +88,7 @@ static const char read_tree_usage[] = "git-read-tree ( | [[-m [--aggressive static struct lock_file lock_file; -int cmd_read_tree(int argc, const char **argv, const char *prefix) +int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) { int i, newfd, stage = 0; unsigned char sha1[20]; @@ -100,9 +100,7 @@ int cmd_read_tree(int argc, const char **argv, const char *prefix) setup_git_directory(); git_config(git_default_config); - newfd = hold_lock_file_for_update(&lock_file, get_index_file()); - if (newfd < 0) - die("unable to create new index file"); + newfd = hold_lock_file_for_update(&lock_file, get_index_file(), 1); git_config(git_default_config);