summaryrefslogtreecommitdiff
path: root/t/t4116-apply-reverse.sh
diff options
context:
space:
mode:
authorLibravatar Stefan Beller <sbeller@google.com>2017-01-17 17:05:20 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-01-25 12:33:33 -0800
commit3d415425c7b6ca0d2243a4589672369e7a02fc2c (patch)
tree5203ddee03812e782602830b3f8862ce62a84900 /t/t4116-apply-reverse.sh
parentt1001: modernize style (diff)
downloadtgif-3d415425c7b6ca0d2243a4589672369e7a02fc2c.tar.xz
unpack-trees: support super-prefix option
In the future we want to support working tree operations within submodules, e.g. "git checkout --recurse-submodules", which will update the submodule to the commit as recorded in its superproject. In the submodule the unpack-tree operation is carried out as usual, but the reporting to the user needs to prefix any path with the superproject. The mechanism for this is the super-prefix. (see 74866d757, git: make super-prefix option) Add support for the super-prefix option for commands that unpack trees by wrapping any path output in unpacking trees in the newly introduced super_prefixed function. This new function prefixes any path with the super-prefix if there is one. Assuming the submodule case doesn't happen in the majority of the cases, we'd want to have a fast behavior for no super prefix, i.e. no reallocation/copying, but just returning path. Another aspect of introducing the `super_prefixed` function is to consider who owns the memory and if this is the right place where the path gets modified. As the super prefix ought to change the output behavior only and not the actual unpack tree part, it is fine to be that late in the line. As we get passed in 'const char *path', we cannot change the path itself, which means in case of a super prefix we have to copy over the path. We need two static buffers in that function as the error messages contain at most two paths. For testing purposes enable it in read-tree, which has no output of paths other than an unpack-trees.c. These are all converted in this patch. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4116-apply-reverse.sh')
0 files changed, 0 insertions, 0 deletions