diff options
author | Jeffrey C. Ollie <jeff@ocjtech.us> | 2007-06-07 07:50:29 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-06-27 22:22:17 -0700 |
commit | 4576518dd7459f44583f33375dbd8799792fc1f3 (patch) | |
tree | 8f5bb082d49b612fdedf589854d8fe5b4fea28dc /builtin-init-db.c | |
parent | git-log: detect dup and fdopen failure (diff) | |
download | tgif-4576518dd7459f44583f33375dbd8799792fc1f3.tar.xz |
Add an option to quiet git-init.
git-init lacks an option to suppress non-error and non-warning output -
this patch adds one.
Signed-off-by: Jeffrey C. Ollie <jeff@ocjtech.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-init-db.c')
-rw-r--r-- | builtin-init-db.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/builtin-init-db.c b/builtin-init-db.c index 976f47b323..d429ceda36 100644 --- a/builtin-init-db.c +++ b/builtin-init-db.c @@ -266,7 +266,7 @@ static int create_default_files(const char *git_dir, const char *template_path) } static const char init_db_usage[] = -"git-init [--template=<template-directory>] [--shared]"; +"git-init [-q | --quiet] [--template=<template-directory>] [--shared]"; /* * If you want to, you can share the DB area with any number of branches. @@ -281,6 +281,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix) const char *template_dir = NULL; char *path; int len, i, reinit; + int quiet = 0; for (i = 1; i < argc; i++, argv++) { const char *arg = argv[1]; @@ -290,6 +291,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix) shared_repository = PERM_GROUP; else if (!prefixcmp(arg, "--shared=")) shared_repository = git_config_perm("arg", arg+9); + else if (!strcmp(arg, "-q") || !strcmp(arg, "--quiet")) + quiet = 1; else usage(init_db_usage); } @@ -336,10 +339,11 @@ int cmd_init_db(int argc, const char **argv, const char *prefix) git_config_set("receive.denyNonFastforwards", "true"); } - printf("%s%s Git repository in %s/\n", - reinit ? "Reinitialized existing" : "Initialized empty", - shared_repository ? " shared" : "", - git_dir); + if (!quiet) + printf("%s%s Git repository in %s/\n", + reinit ? "Reinitialized existing" : "Initialized empty", + shared_repository ? " shared" : "", + git_dir); return 0; } |