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