summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorbrian m. carlson <bk2204@github.com>2020-03-16 18:05:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-03-16 18:37:02 (GMT)
commitdfc8cdc6772a05db4ed64c45df3fe2defdae7eb3 (patch)
tree9e6c2fc6a8add4ce73c8d1fc27ab05984464bd27 /builtin
parent13e7ed6a3a0ecd5d50b7bba2d86ce9d88494fa9b (diff)
downloadgit-dfc8cdc6772a05db4ed64c45df3fe2defdae7eb3.zip
git-dfc8cdc6772a05db4ed64c45df3fe2defdae7eb3.tar.gz
git-dfc8cdc6772a05db4ed64c45df3fe2defdae7eb3.tar.bz2
builtin/clone: compute checkout metadata for clones
When checking out a commit, provide metadata to the filter process including the ref we're using. Signed-off-by: brian m. carlson <bk2204@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/clone.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index 1ad26f4..d28b4d4 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -780,11 +780,11 @@ static int checkout(int submodule_progress)
if (!strcmp(head, "HEAD")) {
if (advice_detached_head)
detach_advice(oid_to_hex(&oid));
+ FREE_AND_NULL(head);
} else {
if (!starts_with(head, "refs/heads/"))
die(_("HEAD not found below refs/heads!"));
}
- free(head);
/* We need to be in the new work tree for the checkout */
setup_work_tree();
@@ -799,6 +799,7 @@ static int checkout(int submodule_progress)
opts.verbose_update = (option_verbosity >= 0);
opts.src_index = &the_index;
opts.dst_index = &the_index;
+ init_checkout_metadata(&opts.meta, head, &oid, NULL);
tree = parse_tree_indirect(&oid);
parse_tree(tree);
@@ -806,6 +807,8 @@ static int checkout(int submodule_progress)
if (unpack_trees(1, &t, &opts) < 0)
die(_("unable to checkout working tree"));
+ free(head);
+
if (write_locked_index(&the_index, &lock_file, COMMIT_LOCK))
die(_("unable to write new index file"));