{"thread":{"id":"8482","subject":"[PATCH 2/2] Quiet the output from git-init when cloning, if requested.","startedAt":"2007-06-07T12:50:29Z","lastAt":"2007-06-07T12:50:30Z","messageCount":2,"participants":["Jeffrey C. Ollie"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"44241","messageId":"11812206303473-git-send-email-jeff@ocjtech.us","threadId":"8482","inReplyTo":null,"subject":"[PATCH 1/2] Add an option to quiet git-init.","fromName":"Jeffrey C. Ollie","fromEmail":"jeff@ocjtech.us","sentAt":"2007-06-07T12:50:29Z","receivedAt":"2007-06-07T12:50:29Z","isPatch":true,"sender":{"key":"jeff@ocjtech.us","avatar":"https://gravatar.com/avatar/95918a1992f277a811c471ae7275f7e4c9d1a2e517ad290bd6aa93b97e8d34f3?d=mp&s=160"},"body":"git-init lacks an option to suppress non-error and non-warning output -\nthis patch adds one.\n\nSigned-off-by: Jeffrey C. Ollie <jeff@ocjtech.us>\n---\n Documentation/git-init-db.txt |    2 +-\n Documentation/git-init.txt    |    6 +++++-\n builtin-init-db.c             |   14 +++++++++-----\n 3 files changed, 15 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/git-init-db.txt b/Documentation/git-init-db.txt\nindex 5412135..64e7fc1 100644\n--- a/Documentation/git-init-db.txt\n+++ b/Documentation/git-init-db.txt\n@@ -8,7 +8,7 @@ git-init-db - Creates an empty git repository\n \n SYNOPSIS\n --------\n-'git-init-db' [--template=<template_directory>] [--shared[=<permissions>]]\n+'git-init-db' [-q | --quiet] [--template=<template_directory>] [--shared[=<permissions>]]\n \n \n DESCRIPTION\ndiff --git a/Documentation/git-init.txt b/Documentation/git-init.txt\nindex 1b64d3a..b5d17ee 100644\n--- a/Documentation/git-init.txt\n+++ b/Documentation/git-init.txt\n@@ -8,7 +8,7 @@ git-init - Create an empty git repository or reinitialize an existing one\n \n SYNOPSIS\n --------\n-'git-init' [--template=<template_directory>] [--shared[=<permissions>]]\n+'git-init' [-q | --quiet] [--template=<template_directory>] [--shared[=<permissions>]]\n \n \n OPTIONS\n@@ -16,6 +16,10 @@ OPTIONS\n \n --\n \n+-q, \\--quiet::\n+\n+Only print error and warning messages, all other output will be suppressed.\n+\n --template=<template_directory>::\n \n Provide the directory from which templates will be used.  The default template\ndiff --git a/builtin-init-db.c b/builtin-init-db.c\nindex 4df9fd0..68b2a1e 100644\n--- a/builtin-init-db.c\n+++ b/builtin-init-db.c\n@@ -265,7 +265,7 @@ static int create_default_files(const char *git_dir, const char *template_path)\n }\n \n static const char init_db_usage[] =\n-\"git-init [--template=<template-directory>] [--shared]\";\n+\"git-init [-q | --quiet] [--template=<template-directory>] [--shared]\";\n \n /*\n  * If you want to, you can share the DB area with any number of branches.\n@@ -280,6 +280,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)\n \tconst char *template_dir = NULL;\n \tchar *path;\n \tint len, i, reinit;\n+\tint quiet = 0;\n \n \tfor (i = 1; i < argc; i++, argv++) {\n \t\tconst char *arg = argv[1];\n@@ -289,6 +290,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)\n \t\t\tshared_repository = PERM_GROUP;\n \t\telse if (!prefixcmp(arg, \"--shared=\"))\n \t\t\tshared_repository = git_config_perm(\"arg\", arg+9);\n+\t\telse if (!strcmp(arg, \"-q\") || !strcmp(arg, \"--quiet\"))\n+\t\t        quiet = 1;\n \t\telse\n \t\t\tusage(init_db_usage);\n \t}\n@@ -335,10 +338,11 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)\n \t\tgit_config_set(\"receive.denyNonFastforwards\", \"true\");\n \t}\n \n-\tprintf(\"%s%s Git repository in %s/\\n\",\n-\t\treinit ? \"Reinitialized existing\" : \"Initialized empty\",\n-\t\tshared_repository ? \" shared\" : \"\",\n-\t\tgit_dir);\n+\tif (!quiet)\n+\t\tprintf(\"%s%s Git repository in %s/\\n\",\n+\t\t       reinit ? \"Reinitialized existing\" : \"Initialized empty\",\n+\t\t       shared_repository ? \" shared\" : \"\",\n+\t\t       git_dir);\n \n \treturn 0;\n }\n-- \n1.5.2.GIT\n"},{"id":"44240","messageId":"11812206302958-git-send-email-jeff@ocjtech.us","threadId":"8482","inReplyTo":"11812206303473-git-send-email-jeff@ocjtech.us","subject":"[PATCH 2/2] Quiet the output from git-init when cloning, if requested.","fromName":"Jeffrey C. Ollie","fromEmail":"jeff@ocjtech.us","sentAt":"2007-06-07T12:50:30Z","receivedAt":"2007-06-07T12:50:30Z","isPatch":true,"sender":{"key":"jeff@ocjtech.us","avatar":"https://gravatar.com/avatar/95918a1992f277a811c471ae7275f7e4c9d1a2e517ad290bd6aa93b97e8d34f3?d=mp&s=160"},"body":"From: Jeffrey C. Ollie <jeff@ocjtech.us>\n\nNow that git-init has an option to quiet itself, use it if the -q\noption was specified on the clone command line.\n\nSigned-off-by: Jeffrey C. Ollie <jeff@ocjtech.us>\n---\n git-clone.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-clone.sh b/git-clone.sh\nindex fdd354f..4cc09e3 100755\n--- a/git-clone.sh\n+++ b/git-clone.sh\n@@ -184,7 +184,7 @@ yes)\n \tGIT_DIR=\"$D\" ;;\n *)\n \tGIT_DIR=\"$D/.git\" ;;\n-esac && export GIT_DIR && git-init ${template+\"$template\"} || usage\n+esac && export GIT_DIR && git-init $quiet ${template+\"$template\"} || usage\n \n if test -n \"$reference\"\n then\n-- \n1.5.2.GIT\n"}]}