Skip to content

Commit 3b0d999

Browse files
committed
Merge branch 'jo/init'
* jo/init: Quiet the output from git-init when cloning, if requested. Add an option to quiet git-init.
2 parents 68f6c01 + 279050d commit 3b0d999

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

Documentation/git-init-db.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ git-init-db - Creates an empty git repository
88

99
SYNOPSIS
1010
--------
11-
'git-init-db' [--template=<template_directory>] [--shared[=<permissions>]]
11+
'git-init-db' [-q | --quiet] [--template=<template_directory>] [--shared[=<permissions>]]
1212

1313

1414
DESCRIPTION

Documentation/git-init.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ git-init - Create an empty git repository or reinitialize an existing one
88

99
SYNOPSIS
1010
--------
11-
'git-init' [--template=<template_directory>] [--shared[=<permissions>]]
11+
'git-init' [-q | --quiet] [--template=<template_directory>] [--shared[=<permissions>]]
1212

1313

1414
OPTIONS
1515
-------
1616

1717
--
1818

19+
-q, \--quiet::
20+
21+
Only print error and warning messages, all other output will be suppressed.
22+
1923
--template=<template_directory>::
2024

2125
Provide the directory from which templates will be used. The default template

builtin-init-db.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ static int create_default_files(const char *git_dir, const char *template_path)
266266
}
267267

268268
static const char init_db_usage[] =
269-
"git-init [--template=<template-directory>] [--shared]";
269+
"git-init [-q | --quiet] [--template=<template-directory>] [--shared]";
270270

271271
/*
272272
* 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)
281281
const char *template_dir = NULL;
282282
char *path;
283283
int len, i, reinit;
284+
int quiet = 0;
284285

285286
for (i = 1; i < argc; i++, argv++) {
286287
const char *arg = argv[1];
@@ -290,6 +291,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
290291
shared_repository = PERM_GROUP;
291292
else if (!prefixcmp(arg, "--shared="))
292293
shared_repository = git_config_perm("arg", arg+9);
294+
else if (!strcmp(arg, "-q") || !strcmp(arg, "--quiet"))
295+
quiet = 1;
293296
else
294297
usage(init_db_usage);
295298
}
@@ -336,10 +339,11 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
336339
git_config_set("receive.denyNonFastforwards", "true");
337340
}
338341

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);
343347

344348
return 0;
345349
}

git-clone.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ yes)
195195
GIT_DIR="$D" ;;
196196
*)
197197
GIT_DIR="$D/.git" ;;
198-
esac && export GIT_DIR && git-init ${template+"$template"} || usage
198+
esac && export GIT_DIR && git-init $quiet ${template+"$template"} || usage
199199

200200
if test -n "$reference"
201201
then

0 commit comments

Comments
 (0)