diff options
author | Junio C Hamano <gitster@pobox.com> | 2007-07-02 21:48:08 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-07-02 21:48:08 -0700 |
commit | 3b0d9992ee9849cf12b16662f2b3c272e6792213 (patch) | |
tree | 28a3a84cc273c7eb4b94f485010b7f6ebc4a1019 | |
parent | 68f6c019fd8d49fbaa72f1aeeb21eb921b6a16bf (diff) | |
parent | 279050d04428e9adaa90aebe54a485a334102ab8 (diff) | |
download | git-3b0d9992ee9849cf12b16662f2b3c272e6792213.tar.gz git-3b0d9992ee9849cf12b16662f2b3c272e6792213.tar.xz |
Merge branch 'jo/init'
* jo/init:
Quiet the output from git-init when cloning, if requested.
Add an option to quiet git-init.
-rw-r--r-- | Documentation/git-init-db.txt | 2 | ||||
-rw-r--r-- | Documentation/git-init.txt | 6 | ||||
-rw-r--r-- | builtin-init-db.c | 14 | ||||
-rwxr-xr-x | git-clone.sh | 2 |
4 files changed, 16 insertions, 8 deletions
diff --git a/Documentation/git-init-db.txt b/Documentation/git-init-db.txt index ab0201aec..d4e01cb32 100644 --- a/Documentation/git-init-db.txt +++ b/Documentation/git-init-db.txt @@ -8,7 +8,7 @@ git-init-db - Creates an empty git repository SYNOPSIS -------- -'git-init-db' [--template=<template_directory>] [--shared[=<permissions>]] +'git-init-db' [-q | --quiet] [--template=<template_directory>] [--shared[=<permissions>]] DESCRIPTION diff --git a/Documentation/git-init.txt b/Documentation/git-init.txt index 413ed6514..07484a4fd 100644 --- a/Documentation/git-init.txt +++ b/Documentation/git-init.txt @@ -8,7 +8,7 @@ git-init - Create an empty git repository or reinitialize an existing one SYNOPSIS -------- -'git-init' [--template=<template_directory>] [--shared[=<permissions>]] +'git-init' [-q | --quiet] [--template=<template_directory>] [--shared[=<permissions>]] OPTIONS @@ -16,6 +16,10 @@ OPTIONS -- +-q, \--quiet:: + +Only print error and warning messages, all other output will be suppressed. + --template=<template_directory>:: Provide the directory from which templates will be used. The default template diff --git a/builtin-init-db.c b/builtin-init-db.c index 976f47b32..d429ceda3 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; } diff --git a/git-clone.sh b/git-clone.sh index 4cbf60f55..262508683 100755 --- a/git-clone.sh +++ b/git-clone.sh @@ -195,7 +195,7 @@ yes) GIT_DIR="$D" ;; *) GIT_DIR="$D/.git" ;; -esac && export GIT_DIR && git-init ${template+"$template"} || usage +esac && export GIT_DIR && git-init $quiet ${template+"$template"} || usage if test -n "$reference" then |