]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git.c
submodules: fix of regression on fetching of non-init subsub-repo
[thirdparty/git.git] / git.c
diff --git a/git.c b/git.c
index 01c456edce923cd895a95a83ac211b6a5e5a3e0c..4bdcdad2ccd3e7b268074dcffcbc9bbcbf273e8b 100644 (file)
--- a/git.c
+++ b/git.c
@@ -534,6 +534,7 @@ static struct cmd_struct commands[] = {
        { "ls-tree", cmd_ls_tree, RUN_SETUP },
        { "mailinfo", cmd_mailinfo, RUN_SETUP_GENTLY | NO_PARSEOPT },
        { "mailsplit", cmd_mailsplit, NO_PARSEOPT },
+       { "maintenance", cmd_maintenance, RUN_SETUP_GENTLY | NO_PARSEOPT },
        { "merge", cmd_merge, RUN_SETUP | NEED_WORK_TREE },
        { "merge-base", cmd_merge_base, RUN_SETUP },
        { "merge-file", cmd_merge_file, RUN_SETUP_GENTLY },
@@ -637,6 +638,25 @@ static void list_builtins(struct string_list *out, unsigned int exclude_option)
        }
 }
 
+void load_builtin_commands(const char *prefix, struct cmdnames *cmds)
+{
+       const char *name;
+       int i;
+
+       /*
+        * Callers can ask for a subset of the commands based on a certain
+        * prefix, which is then dropped from the added names. The names in
+        * the `commands[]` array do not have the `git-` prefix, though,
+        * therefore we must expect the `prefix` to at least start with `git-`.
+        */
+       if (!skip_prefix(prefix, "git-", &prefix))
+               BUG("prefix '%s' must start with 'git-'", prefix);
+
+       for (i = 0; i < ARRAY_SIZE(commands); i++)
+               if (skip_prefix(commands[i].cmd, prefix, &name))
+                       add_cmdname(cmds, name, strlen(name));
+}
+
 #ifdef STRIP_EXTENSION
 static void strip_extension(const char **argv)
 {