Add an option to quiet git-init.
PATCH 1/2 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 <[email protected]>
--- Documentation/git-init-db.txt | 2 +- Documentation/git-init.txt | 6 +++++- builtin-init-db.c | 14 +++++++++----- 3 files changed, 15 insertions(+), 7 deletions(-)
Documentation/git-init-db.txt +1 -1
@@ -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
Documentation/git-init.txt +5 -1
@@ -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
builtin-init-db.c +9 -5
@@ -265,7 +265,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.
@@ -280,6 +280,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 ];
@@ -289,6 +290,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 ; elseusage (init_db_usage ); }
@@ -335,10 +338,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 ; }
Signature · 1 line
1.5.2.GIT
PATCH 2/2 Quiet the output from git-init when cloning, if requested.
From: Jeffrey C. Ollie <[email protected]>
Now that git-init has an option to quiet itself, use it if the -q option was specified on the clone command line.
Signed-off-by Jeffrey C. Ollie <[email protected]>
--- git-clone.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
git-clone.sh +1 -1
@@ -184,7 +184,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
Signature · 1 line
1.5.2.GIT