Re: [PATCH 15/15] builtin/checkout: add --recurse-submodules switch
- From
Ramsay Jones <ramsay@ramsayjones.plus.com>
- Date
- Feb 24, 2017, 01:25 UTC
- Message-ID
- <db5cfde2-a769-d786-8846-a5a526194b69@ramsayjones.plus.com>
- In-Reply-To
- <20170223225735.10994-16-sbeller@google.com>
On 23/02/17 22:57, Stefan Beller wrote:
Show 44 quoted lines
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> Documentation/git-checkout.txt | 7 +++++++
> builtin/checkout.c | 28 ++++++++++++++++++++++++++++
> t/lib-submodule-update.sh | 33 ++++++++++++++++++++++++---------
> t/t2013-checkout-submodule.sh | 5 +++++
> 4 files changed, 64 insertions(+), 9 deletions(-)
>
> diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
> index 8e2c0662dd..d6399c0af8 100644
> --- a/Documentation/git-checkout.txt
> +++ b/Documentation/git-checkout.txt
> @@ -256,6 +256,13 @@ section of linkgit:git-add[1] to learn how to operate the `--patch` mode.
> out anyway. In other words, the ref can be held by more than one
> worktree.
>
> +--[no-]recurse-submodules::
> + Using --recurse-submodules will update the content of all initialized
> + submodules according to the commit recorded in the superproject. If
> + local modifications in a submodule would be overwritten the checkout
> + will fail unless `-f` is used. If nothing (or --no-recurse-submodules)
> + is used, the work trees of submodules will not be updated.
> +
> <branch>::
> Branch to checkout; if it refers to a branch (i.e., a name that,
> when prepended with "refs/heads/", is a valid ref), then that
> diff --git a/builtin/checkout.c b/builtin/checkout.c
> index f174f50303..207ce09771 100644
> --- a/builtin/checkout.c
> +++ b/builtin/checkout.c
> @@ -21,12 +21,31 @@
> #include "submodule-config.h"
> #include "submodule.h"
>
> +static int recurse_submodules = RECURSE_SUBMODULES_DEFAULT;
> +
> static const char * const checkout_usage[] = {
> N_("git checkout [<options>] <branch>"),
> N_("git checkout [<options>] [<branch>] -- <file>..."),
> NULL,
> };
>
> +int option_parse_recurse_submodules(const struct option *opt,
> + const char *arg, int unset)Again, this function should be marked static.
[I also noted _two_ other local functions with the same name in builtin/fetch.c and builtin/push.c]
ATB, Ramsay Jones