Re: [PATCHv4 2/3] submodule: implement `name` as a builtin helper
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Sep 1, 2015, 19:01 UTC
- Message-ID
- <CAPig+cTqJwx27s7bNdn7g2m5UOK28JdnXcWWvkduQiuMyDZo1g@mail.gmail.com>
- In-Reply-To
- <1441131869-29474-3-git-send-email-sbeller@google.com>
On Tue, Sep 1, 2015 at 2:24 PM, Stefan Beller <sbeller@google.com> wrote:
> This implements the helper `module_name` in C instead of shell,
You probably want s/module_name/name/ or state more explicitly:
Reimplement `module_name` shell function in C as `name`.
or something.
Show 15 quoted lines
> yielding a nice performance boost.
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
> index 16d9abe..f5e408a 100644
> --- a/builtin/submodule--helper.c
> +++ b/builtin/submodule--helper.c
> @@ -102,6 +105,24 @@ static int module_list(int argc, const char **argv, const char *prefix)
> +static int module_name(int argc, const char **argv, const char *prefix)
> +{
> + const struct submodule *sub;
> +
> + if (argc != 2)
> + usage("git submodule--helper module_name <path>\n");Mentioned previously[1]:
usage(_("...")); s/module_name/name/ s/\\n//
[1]: http://article.gmane.org/gmane.comp.version-control.git/276965
Show 6 quoted lines
> + gitmodules_config();
> + sub = submodule_from_path(null_sha1, argv[1]);
> +
> + if (!sub)
> + die(N_("No submodule mapping found in .gitmodules for path '%s'"),
> + argv[1]);s/N_/_/ s/No/no/
Show 13 quoted lines
> + printf("%s\n", sub->name);
> +
> + return 0;
> +}
>
> struct cmd_struct {
> const char *cmd;
> @@ -110,6 +131,7 @@ struct cmd_struct {
>
> static struct cmd_struct commands[] = {
> {"list", module_list},
> + {"name", module_name},
> };