Prepare checkout_entry() for recursive checkout of submodules

The bitfield in "struct checkout" gets a new member "recurse_submodules".
The new function checkout_submodule() is called by checkout_entry() when
"recurse_submodules" is true.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Prepare unpack_trees() for recursive checkout of submodules

To be able to checkout submodule content the member "recurse_submodules"
is added to "struct unpack_trees_options". In "unpack_callback()" it is
used to initialize the recently introduced member with the same name in
"struct checkout".

When this flag is set verify_uptodate_1() will consider submodules whose
HEAD differs from the commit in the superproject as modified. Even if
they both match, it is checked if the checkout in the submodule would
overwrite modified files.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Teach checkout to recursively checkout submodules

Change the default behavior of "git checkout" to check out populated
submodules too. If the checkout would overwrite local submodule changes
it will fail unless forced. This new default behavior can be prevented
by using the "--no-recurse-submodules" option.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Teach checkout-index the --recurse-submodules option

Add the "--recurse-submodules" option to "git checkout-index". When this
option is used populated submodules will be checked out recursively.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Teach read-tree the --recurse-submodules option

Add the "--recurse-submodules" option to "git read-tree". When this option
is used together with -m or -u, populated submodules will be checked out
recursively.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Teach reset to recursively reset submodules

Change the default behavior of "git reset --hard" to check out populated
submodules too. This can be prevented using the "--no-recurse-submodules"
option.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Teach merge to recursively checkout submodule merge results

Change the default behavior of "git merge" to update the work tree of
populated submodules to the merge result. This can be prevented by
using the "--no-recurse-submodules" option.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
git gui: Use the --recurse-submodules option for read-tree when available

Since version 1.8.0 git supports the "--recurse-submodules" option for the
read-tree command to update populated submodules too. Use this option when
we find a git version new enough to support this. Now checking out
branches and resetting after a failed merge will update submodules work
trees too unless that would overwrite local changes.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
git gui: Use the --recurse-submodules option for checkout-index when available

Since version 1.8.0 git supports the "--recurse-submodules" option for the
checkout-index command to update populated submodules too. Use this option
when we find a git version new enough to support this. Now checking out
branches and resetting after a failed merge will update submodules work
trees too unless that would overwrite local changes.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>