Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-10-09 07:53:26 +0300
committerJunio C Hamano <gitster@pobox.com>2020-10-09 07:53:26 +0300
commit86e1007abc58f8458ce90dc10a385239722cf08a (patch)
tree8d7ae6caf3219ff0684ebefdb4df704649940836 /git.c
parent08f06e542d3f36cf1044f32fd7f84576fa2f324b (diff)
parent722fc374914d4f9b37d42a8eda603eecb790f64c (diff)
Merge branch 'js/no-builtins-on-disk-option'
Hotfix to breakage introduced in the topic in v2.29-rc0 * js/no-builtins-on-disk-option: help: do not expect built-in commands to be hardlinked
Diffstat (limited to 'git.c')
-rw-r--r--git.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/git.c b/git.c
index f1e8b56d99..4bdcdad2cc 100644
--- a/git.c
+++ b/git.c
@@ -638,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)
{