path: root/merge-recursive.c
diff options
authorbrian m. carlson <>2020-03-16 18:05:02 (GMT)
committerJunio C Hamano <>2020-03-16 18:37:02 (GMT)
commitab90ecae992e44e3e8303f143ad858608acabcf5 (patch)
tree70956e3f2cd7b14b35bc0ef26c72475b27550bea /merge-recursive.c
parenta8604766de8136d78944053aadd74a8c1c87aea9 (diff)
convert: permit passing additional metadata to filter processes
There are a variety of situations where a filter process can make use of some additional metadata. For example, some people find the ident filter too limiting and would like to include the commit or the branch in their smudged files. This information isn't available during checkout as HEAD hasn't been updated at that point, and it wouldn't be available in archives either. Let's add a way to pass this metadata down to the filter. We pass the blob we're operating on, the treeish (preferring the commit over the tree if one exists), and the ref we're operating on. Note that we won't pass this information in all cases, such as when renormalizing or when we're performing diffs, since it doesn't make sense in those cases. The data we currently get from the filter process looks like the following: command=smudge pathname=git.c 0000 With this change, we'll get data more like this: command=smudge pathname=git.c refname=refs/tags/v2.25.1 treeish=c522f061d551c9bb8684a7c3859b2ece4499b56b blob=7be7ad34bd053884ec48923706e70c81719a8660 0000 There are a couple things to note about this approach. For operations like checkout, treeish will always be a commit, since we cannot check out individual trees, but for other operations, like archive, we can end up operating on only a particular tree, so we'll provide only a tree as the treeish. Similar comments apply for refname, since there are a variety of cases in which we won't have a ref. This commit wires up the code to print this information, but doesn't pass any of it at this point. In a future commit, we'll have various code paths pass the actual useful data down. Signed-off-by: brian m. carlson <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'merge-recursive.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index 7a4e6f2..d92e2ac 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -958,7 +958,7 @@ static int update_file_flags(struct merge_options *opt,
if (S_ISREG(contents->mode)) {
struct strbuf strbuf = STRBUF_INIT;
if (convert_to_working_tree(opt->repo->index,
- path, buf, size, &strbuf)) {
+ path, buf, size, &strbuf, NULL)) {
size = strbuf.len;
buf = strbuf_detach(&strbuf, NULL);