path: root/entry.c
diff options
authorbrian m. carlson <>2020-03-16 18:05:03 (GMT)
committerJunio C Hamano <>2020-03-16 18:37:02 (GMT)
commitc397aac02f9f97976f675115aa5df6ca01e26d59 (patch)
treec643560e7d3acf29889cc23498029a8bc956cc5a /entry.c
parentab90ecae992e44e3e8303f143ad858608acabcf5 (diff)
convert: provide additional metadata to filters
Now that we have the codebase wired up to pass any additional metadata to filters, let's collect the additional metadata that we'd like to pass. The two main places we pass this metadata are checkouts and archives. In these two situations, reading HEAD isn't a valid option, since HEAD isn't updated for checkouts until after the working tree is written and archives can accept an arbitrary tree. In other situations, HEAD will usually reflect the refname of the branch in current use. We pass a smaller amount of data in other cases, such as git cat-file, where we can really only logically know about the blob. This commit updates only the parts of the checkout code where we don't use unpack_trees. That function and callers of it will be handled in a future commit. In the archive code, we leak a small amount of memory, since nothing we pass in the archiver argument structure is freed. Signed-off-by: brian m. carlson <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'entry.c')
1 files changed, 5 insertions, 2 deletions
diff --git a/entry.c b/entry.c
index 4b2d9b2..00b4903 100644
--- a/entry.c
+++ b/entry.c
@@ -264,6 +264,9 @@ static int write_entry(struct cache_entry *ce,
size_t newsize = 0;
struct stat st;
const struct submodule *sub;
+ struct checkout_metadata meta;
+ clone_checkout_metadata(&meta, &state->meta, &ce->oid);
if (ce_mode_s_ifmt == S_IFREG) {
struct stream_filter *filter = get_stream_filter(state->istate, ce->name,
@@ -315,13 +318,13 @@ static int write_entry(struct cache_entry *ce,
if (dco && dco->state != CE_NO_DELAY) {
ret = async_convert_to_working_tree(state->istate, ce->name, new_blob,
- size, &buf, NULL, dco);
+ size, &buf, &meta, dco);
if (ret && string_list_has_string(&dco->paths, ce->name)) {
goto delayed;
} else
- ret = convert_to_working_tree(state->istate, ce->name, new_blob, size, &buf, NULL);
+ ret = convert_to_working_tree(state->istate, ce->name, new_blob, size, &buf, &meta);
if (ret) {