On Tue, Sep 1, 2015 at 2:24 PM, Stefan Beller <sbeller@xxxxxxxxxx> 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. > yielding a nice performance boost. > > Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx> > --- > 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 > + 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/ > + 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}, > }; -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html