merge-ort: introduce wrappers for alternate tree traversal
commita68e6cea59a38a3be4feaf9cba9a409a8da92475
authorElijah Newren <newren@gmail.com>
Thu, 11 Mar 2021 00:38:27 +0000 (11 00:38 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 11 Mar 2021 06:18:05 +0000 (10 22:18 -0800)
tree204042db7a4a455f47ee44c7358eaa8206590bb2
parentbeb06145f83813505397d420bddef0231c127426
merge-ort: introduce wrappers for alternate tree traversal

Add traverse_trees_wrapper() and traverse_trees_wrapper_callback()
functions.  The former runs traverse_trees() with info->fn set to
traverse_trees_wrapper_callback, in order to simply save all the entries
without processing or recursing into any of them.  This step allows
extra computation to be done (e.g. checking some condition across all
files) that can be used later.  Then, after that is completed, it
iterates over all the saved entries and calls the original info->fn
callback with the saved data.

Currently, this does nothing more than marginally slowing down the tree
traversal since we do not take advantage of the opportunity to compute
anything special in traverse_trees_wrapper_callback(), and thus the real
callback will be called identically as it would have been without this
extra wrapper.  However, a subsequent commit will add some special
computation of some values that the real callback will be able to use.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-ort.c