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>
This commit is contained in:
brian m. carlson
2020-03-16 18:05:04 +00:00
committed by Junio C Hamano
parent c397aac02f
commit 13e7ed6a3a
6 changed files with 68 additions and 33 deletions

View File

@@ -85,6 +85,7 @@ struct unpack_trees_options {
struct index_state result;
struct pattern_list *pl; /* for internal use */
struct checkout_metadata meta;
};
int unpack_trees(unsigned n, struct tree_desc *t,