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>
Jeffrey C. Ollie committed
Jun 7, 2007 at 07:50 UTC
4576518dd7459f44583f33375dbd8799792fc1f3
3 files changed
+15
-7
Documentation/git-init-db.txt
+1
-1
@@ -8,7 +8,7 @@ git-init-db - Creates an empty git repository
8
9
SYNOPSIS
10
--------
11
-'git-init-db' [--template=<template_directory>] [--shared[=<permissions>]]
11
+'git-init-db' [-q | --quiet] [--template=<template_directory>] [--shared[=<permissions>]]
12
13
14
DESCRIPTION
Documentation/git-init.txt
+5
-1
@@ -8,7 +8,7 @@ git-init - Create an empty git repository or reinitialize an existing one
8
9
SYNOPSIS
10
--------
11
-'git-init' [--template=<template_directory>] [--shared[=<permissions>]]
11
+'git-init' [-q | --quiet] [--template=<template_directory>] [--shared[=<permissions>]]
12
13
14
OPTIONS
@@ -16,6 +16,10 @@ OPTIONS
16
17
--
18
19
+-q, \--quiet::
20
+
21
+Only print error and warning messages, all other output will be suppressed.
22
+
23
--template=<template_directory>::
24
25
Provide the directory from which templates will be used. The default template
builtin-init-db.c
+9
-5
@@ -266,7 +266,7 @@ static int create_default_files(const char *git_dir, const char *template_path)
266
}
267
268
static const char init_db_usage[] =
269
-"git-init [--template=<template-directory>] [--shared]";
269
+"git-init [-q | --quiet] [--template=<template-directory>] [--shared]";
270
271
/*
272
* 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)
281
const char *template_dir = NULL;
282
char *path;
283
int len, i, reinit;
284
+ int quiet = 0;
285
286
for (i = 1; i < argc; i++, argv++) {
287
const char *arg = argv[1];
@@ -290,6 +291,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
291
shared_repository = PERM_GROUP;
292
else if (!prefixcmp(arg, "--shared="))
293
shared_repository = git_config_perm("arg", arg+9);
294
+ else if (!strcmp(arg, "-q") || !strcmp(arg, "--quiet"))
295
+ quiet = 1;
296
else
297
usage(init_db_usage);
298
}
@@ -336,10 +339,11 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
339
git_config_set("receive.denyNonFastforwards", "true");
340
}
341
339
- printf("%s%s Git repository in %s/\n",
340
- reinit ? "Reinitialized existing" : "Initialized empty",
341
- shared_repository ? " shared" : "",
342
- git_dir);
342
+ if (!quiet)
343
+ printf("%s%s Git repository in %s/\n",
344
+ reinit ? "Reinitialized existing" : "Initialized empty",
345
+ shared_repository ? " shared" : "",
346
+ git_dir);
347
348
return 0;
349
}