git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jeffrey C. Ollie" <jeff@ocjtech.us>
To: Junio C Hamano <junkio@cox.net>
Cc: Git Mailing List <git@vger.kernel.org>,
	"Jeffrey C. Ollie" <jeff@ocjtech.us>
Subject: [PATCH 1/2] Add an option to quiet git-init.
Date: Thu,  7 Jun 2007 07:50:29 -0500	[thread overview]
Message-ID: <11812206303473-git-send-email-jeff@ocjtech.us> (raw)

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>
---
 Documentation/git-init-db.txt |    2 +-
 Documentation/git-init.txt    |    6 +++++-
 builtin-init-db.c             |   14 +++++++++-----
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/Documentation/git-init-db.txt b/Documentation/git-init-db.txt
index 5412135..64e7fc1 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 1b64d3a..b5d17ee 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 4df9fd0..68b2a1e 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -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;
 		else
 			usage(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;
 }
-- 
1.5.2.GIT

             reply	other threads:[~2007-06-07 12:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-07 12:50 Jeffrey C. Ollie [this message]
2007-06-07 12:50 ` [PATCH 2/2] Quiet the output from git-init when cloning, if requested Jeffrey C. Ollie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11812206303473-git-send-email-jeff@ocjtech.us \
    --to=jeff@ocjtech.us \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).