]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git.c
Merge branch 'ab/config-mak-uname-simplify'
[thirdparty/git.git] / git.c
diff --git a/git.c b/git.c
index f1e8b56d99c29f6daaa99cdc6ab52dc62091f333..4b7bd77b809b1d353b591c16aab83af5ab3a6a71 100644 (file)
--- a/git.c
+++ b/git.c
@@ -516,6 +516,7 @@ static struct cmd_struct commands[] = {
        { "fetch-pack", cmd_fetch_pack, RUN_SETUP | NO_PARSEOPT },
        { "fmt-merge-msg", cmd_fmt_merge_msg, RUN_SETUP },
        { "for-each-ref", cmd_for_each_ref, RUN_SETUP },
+       { "for-each-repo", cmd_for_each_repo, RUN_SETUP_GENTLY },
        { "format-patch", cmd_format_patch, RUN_SETUP },
        { "fsck", cmd_fsck, RUN_SETUP },
        { "fsck-objects", cmd_fsck, RUN_SETUP },
@@ -638,6 +639,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)
 {