builtin/clone: convert to struct object_id
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
0c77cd24f8
commit
ddc2cc64e1
@ -681,7 +681,7 @@ static void update_head(const struct ref *our, const struct ref *remote,
|
|||||||
|
|
||||||
static int checkout(int submodule_progress)
|
static int checkout(int submodule_progress)
|
||||||
{
|
{
|
||||||
unsigned char sha1[20];
|
struct object_id oid;
|
||||||
char *head;
|
char *head;
|
||||||
struct lock_file *lock_file;
|
struct lock_file *lock_file;
|
||||||
struct unpack_trees_options opts;
|
struct unpack_trees_options opts;
|
||||||
@ -692,7 +692,7 @@ static int checkout(int submodule_progress)
|
|||||||
if (option_no_checkout)
|
if (option_no_checkout)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
head = resolve_refdup("HEAD", RESOLVE_REF_READING, sha1, NULL);
|
head = resolve_refdup("HEAD", RESOLVE_REF_READING, oid.hash, NULL);
|
||||||
if (!head) {
|
if (!head) {
|
||||||
warning(_("remote HEAD refers to nonexistent ref, "
|
warning(_("remote HEAD refers to nonexistent ref, "
|
||||||
"unable to checkout.\n"));
|
"unable to checkout.\n"));
|
||||||
@ -700,7 +700,7 @@ static int checkout(int submodule_progress)
|
|||||||
}
|
}
|
||||||
if (!strcmp(head, "HEAD")) {
|
if (!strcmp(head, "HEAD")) {
|
||||||
if (advice_detached_head)
|
if (advice_detached_head)
|
||||||
detach_advice(sha1_to_hex(sha1));
|
detach_advice(oid_to_hex(&oid));
|
||||||
} else {
|
} else {
|
||||||
if (!starts_with(head, "refs/heads/"))
|
if (!starts_with(head, "refs/heads/"))
|
||||||
die(_("HEAD not found below refs/heads!"));
|
die(_("HEAD not found below refs/heads!"));
|
||||||
@ -721,7 +721,7 @@ static int checkout(int submodule_progress)
|
|||||||
opts.src_index = &the_index;
|
opts.src_index = &the_index;
|
||||||
opts.dst_index = &the_index;
|
opts.dst_index = &the_index;
|
||||||
|
|
||||||
tree = parse_tree_indirect(sha1);
|
tree = parse_tree_indirect(oid.hash);
|
||||||
parse_tree(tree);
|
parse_tree(tree);
|
||||||
init_tree_desc(&t, tree->buffer, tree->size);
|
init_tree_desc(&t, tree->buffer, tree->size);
|
||||||
if (unpack_trees(1, &t, &opts) < 0)
|
if (unpack_trees(1, &t, &opts) < 0)
|
||||||
@ -731,7 +731,7 @@ static int checkout(int submodule_progress)
|
|||||||
die(_("unable to write new index file"));
|
die(_("unable to write new index file"));
|
||||||
|
|
||||||
err |= run_hook_le(NULL, "post-checkout", sha1_to_hex(null_sha1),
|
err |= run_hook_le(NULL, "post-checkout", sha1_to_hex(null_sha1),
|
||||||
sha1_to_hex(sha1), "1", NULL);
|
oid_to_hex(&oid), "1", NULL);
|
||||||
|
|
||||||
if (!err && option_recursive) {
|
if (!err && option_recursive) {
|
||||||
struct argv_array args = ARGV_ARRAY_INIT;
|
struct argv_array args = ARGV_ARRAY_INIT;
|
||||||
|
Reference in New Issue
Block a user