summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
Diffstat (limited to 'git.c')
-rw-r--r--git.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/git.c b/git.c
index c03de2c090..5be27b07e5 100644
--- a/git.c
+++ b/git.c
@@ -18,6 +18,8 @@ const char git_more_info_string[] =
static int use_pager = -1;
+static void list_builtins(void);
+
static void commit_pager_choice(void) {
switch (use_pager) {
case 0:
@@ -189,6 +191,9 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
}
(*argv)++;
(*argc)--;
+ } else if (!strcmp(cmd, "--list-builtins")) {
+ list_builtins();
+ exit(0);
} else {
fprintf(stderr, "Unknown option: %s\n", cmd);
usage(git_usage_string);
@@ -483,6 +488,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);
+}
+
#ifdef STRIP_EXTENSION
static void strip_extension(const char **argv)
{