Skip to content

Recursively checkout submodules

Jens Lehmann git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4Prepare checkout_entry() for recursive checkout of submodulesbuiltin/apply.c builtin/checkout-index.c builtin/checkout.c +5 more+45 -45 replies
2/4Add "ignore_submodules" member to "struct unpack_trees_options"archive.c builtin/clone.c builtin/commit.c +7 more+13 -20 replies
3/4Teach checkout to recursively checkout submodulesDocumentation/git-checkout.txt builtin/checkout.c t/t2013-checkout-submodule.sh+25 -30 replies
4/4Teach checkout-index to recursively checkout submodulesDocumentation/git-checkout-index.txt builtin/checkout-index.c+12 -32 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [WIP PATCH 0/4] Recursively checkout submodules

Having found some Git time recently i started to tackle the next major issue on my agenda to improve submodule experience: Check out the matching versions of populated submodules when doing a checkout in the superproject (without having to do an explicit "git submodule update").

So here is what i came up with so far: The first two patches lay the groundwork by introducing a new function checkout_submodule() in submodule.c and calling it from checkout_entry(). The new "ignore_submodules" flags added to "struct checkout" and "struct unpack_trees_options" can be used to prevent that (and default to true, which is the old behavior then changed by the following patches). The next two patches teach "git checkout" and "git checkout-index" to default to checking out submodules too unless the new option "--ignore-subodules" is used.

What's working:
* Changing branches and specific revisions update the submodules accordingly
* "Revert changes" in "git gui" resets submodules now

What's missing:
* Test cases
* I think "git fetch" should recurse into populated submodules too, otherwise the commits to check out there might be missing

Opinions?

Jens Lehmann (4):
Prepare checkout_entry() for recursive checkout of submodules Add "ignore_submodules" member to "struct unpack_trees_options" Teach checkout to recursively checkout submodules Teach checkout-index to recursively checkout submodules

 Documentation/git-checkout-index.txt |    9 ++++++++-
 Documentation/git-checkout.txt       |    7 +++++++
 archive.c                            |    1 +
 builtin/apply.c                      |    1 +
 builtin/checkout-index.c             |    5 ++++-
 builtin/checkout.c                   |    6 ++++++
 builtin/clone.c                      |    1 +
 builtin/commit.c                     |    1 +
 builtin/merge.c                      |    2 ++
 builtin/read-tree.c                  |    1 +
 builtin/reset.c                      |    1 +
 cache.h                              |    3 ++-
 diff-lib.c                           |    2 ++
 entry.c                              |    9 ++++++---
 merge-recursive.c                    |    1 +
 submodule.c                          |   32 ++++++++++++++++++++++++++++++++
 submodule.h                          |    1 +
 t/t2013-checkout-submodule.sh        |   14 ++++++++++++--
 unpack-trees.c                       |    1 +
 unpack-trees.h                       |    3 ++-
 20 files changed, 92 insertions(+), 9 deletions(-)