git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] init-db: use OPT__QUIET macro instead OPT_BIT

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 14, 2015, 19:08 UTC
Message-ID
<xmqqa91l9o3k.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1421256762-26765-1-git-send-email-kuleshovmail@gmail.com>
Alexander Kuleshov <kuleshovmail@gmail.com> writes:
Show 7 quoted lines
> There is OPT__QUIET macro for easily -q/--quiet option defenition,
> let's use it instead OPT_BIT
>
> Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
> ---
>  builtin/init-db.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
This is questionable for three reasons.
 - OPT__QUIET() takes an integer and counts up; a single -q and
   double -q -q will give different values to the given variable so
   that the user can express varying levels of quietness.  You can
   no longer check the value with "& INIT_DB_QUIET".
 - We did "flags" very deliberately because we wanted to make sure
   we do not have to add different parameters to init_db() every
   time we wanted a new small knob to tweak its operation like
   "quiet", "verbose", etc.
 - We have been trying to move away from OPT__VERBOSE() and
   OPT__QUIET() to OPT__VERBOSITY(), so that we can handle
   combinations of --quiet and --verbose on the command line in a
   more sensible manner.

I am OK if you switched to OPT__VERBOSITY(), in anticipation of more verbose output from the command in the future, though.

Show 19 quoted lines
> diff --git a/builtin/init-db.c b/builtin/init-db.c
> index 280454a..a89343b 100644
> --- a/builtin/init-db.c
> +++ b/builtin/init-db.c
> @@ -368,7 +368,7 @@ static void separate_git_dir(const char *git_dir)
>  	write_file(git_link, 1, "gitdir: %s\n", git_dir);
>  }
>  
> -int init_db(const char *template_dir, unsigned int flags)
> +int init_db(const char *template_dir, unsigned int quiet)
>  {
>  	int reinit;
>  	const char *git_dir = get_git_dir();
> @@ -411,8 +411,7 @@ int init_db(const char *template_dir, unsigned int flags)
>  		git_config_set("core.sharedrepository", buf);
>  		git_config_set("receive.denyNonFastforwards", "true");
>  	}
> -	if (!(flags & INIT_DB_QUIET)) {
> +	if (!(quiet & INIT_DB_QUIET)) {
Previous: Alexander Kuleshov
Message 2 of 2 in “init-db: use OPT__QUIET macro instead OPT_BIT”
  1. init-db: use OPT__QUIET macro instead OPT_BITAlexander Kuleshov, Jan 14, 2015
  2. Junio C HamanoJan 14, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.