Commit 8893fd95 authored by Jeff King's avatar Jeff King Committed by Junio C Hamano

git: add hidden --list-builtins option

It can be useful in the test suite to be able to iterate
over the list of builtins. We could do this with some
Makefile magic. But since the authoritative list is in the
commands array inside git.c, and since this could also be
handy for debugging, let's add a hidden command-line option
to dump that list.
Signed-off-by: default avatarJeff King <>
Signed-off-by: default avatarJunio C Hamano <>
parent b48cbfc5
......@@ -26,6 +26,8 @@ static const char *env_names[] = {
static char *orig_env[4];
static int save_restore_env_balance;
static void list_builtins(void);
static void save_env_before_alias(void)
int i;
......@@ -232,6 +234,9 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
} else if (!strcmp(cmd, "--list-builtins")) {
} else {
fprintf(stderr, "Unknown option: %s\n", cmd);
......@@ -529,6 +534,13 @@ int is_builtin(const char *s)
return !!get_builtin(s);
static void list_builtins(void)
int i;
for (i = 0; i < ARRAY_SIZE(commands); i++)
printf("%s\n", commands[i].cmd);
static void strip_extension(const char **argv)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment