reset/checkout/read-tree: unify config callback for submodule recursion
commitd7a3803f9e83242adac0f02af843ef0520c71f0a
authorStefan Beller <sbeller@google.com>
Fri, 26 May 2017 19:10:12 +0000 (26 12:10 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 30 May 2017 05:28:53 +0000 (30 14:28 +0900)
tree8bf2a8812f7529fdb56606719db8e674fdf47d09
parent17f38cb704623561fb4efd143429d63149f585d8
reset/checkout/read-tree: unify config callback for submodule recursion

The callback function is essentially duplicated 3 times. Remove all
of them and offer a new callback function, that lives in submodule.c

By putting the callback function there, we no longer need the function
'set_config_update_recurse_submodules', nor duplicate the global variable
in each builtin as well as submodule.c

In the three builtins we have different 2 ways how to load the .gitmodules
and config file, which are slightly different. git-checkout has to load
the submodule config all the time due to 23b4c7bcc5 (checkout: Use
submodule.*.ignore settings from .git/config and .gitmodules, 2010-08-28)

git-reset and git-read-tree do not respect these diff settings, so loading
the submodule configuration is optional. Also put that into submodule.c
for code deduplication.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout.c
builtin/read-tree.c
builtin/reset.c
submodule.c
submodule.h