builtin/checkout: compute checkout metadata for checkouts
Provide commit metadata for checkout code paths that use unpack_trees
and friends. When we're checking out a commit, use the commit
information, but don't provide commit information if we're checking out
from the index, since there need not be any particular commit associated
with the index, and even if there is one, we can't know what it is.
Signed-off-by: brian m. carlson <bk2204@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff --git a/merge.c b/merge.c
index 7c1d756..aa36de2 100644
--- a/merge.c
+++ b/merge.c
@@ -94,6 +94,7 @@ int checkout_fast_forward(struct repository *r,
opts.verbose_update = 1;
opts.merge = 1;
opts.fn = twoway_merge;
+ init_checkout_metadata(&opts.meta, NULL, remote, NULL);
setup_unpack_trees_porcelain(&opts, "merge");
if (unpack_trees(nr_trees, t, &opts)) {