git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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},
>  };
Previous: Stefan BellerNext: Stefan Beller
Message 7 of 12 in “[PATCHv4 0/3] submodule--helper: Have some refactoring only patches first”
  1. Stefan BellerSep 1, 2015
  2. 1/3 submodule: implement `list` as a builtin helperStefan Beller, Sep 1, 2015
  3. Junio C HamanoSep 1, 2015
  4. Junio C HamanoSep 2, 2015
  5. Eric SunshineSep 1, 2015
  6. 2/3 submodule: implement `name` as a builtin helperStefan Beller, Sep 1, 2015
  7. Eric SunshineSep 1, 2015
  8. 3/3 submodule: implement `clone` as a builtin helperStefan Beller, Sep 1, 2015
  9. Eric SunshineSep 1, 2015
  10. Jeff KingSep 1, 2015
  11. Eric SunshineSep 1, 2015
  12. Junio C HamanoSep 1, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.