git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Gregory Szorc" <gregory.szorc@gmail.com>,
	"Eric Wong" <e@80x24.org>,
	git@vger.kernel.org
Subject: Re: [PATCH 2/3] repack: silence warnings when auto-enabled bitmaps cannot be built
Date: Wed, 31 Jul 2019 13:26:12 -0700	[thread overview]
Message-ID: <xmqqftmmosrf.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20190731053927.GB16941@sigill.intra.peff.net> (Jeff King's message of "Wed, 31 Jul 2019 01:39:27 -0400")

Jeff King <peff@peff.net> writes:

> @@ -3313,8 +3319,13 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
>  			    N_("do not hide commits by grafts"), 0),
>  		OPT_BOOL(0, "use-bitmap-index", &use_bitmap_index,
>  			 N_("use a bitmap index if available to speed up counting objects")),
> -		OPT_BOOL(0, "write-bitmap-index", &write_bitmap_index,
> -			 N_("write a bitmap index together with the pack index")),
> +		OPT_SET_INT(0, "write-bitmap-index", &write_bitmap_index,
> +			    N_("write a bitmap index together with the pack index"),
> +			    WRITE_BITMAP_TRUE),
> +		OPT_SET_INT_F(0, "write-bitmap-index-quiet",
> +			      &write_bitmap_index,
> +			      N_("write a bitmap index if possible"),
> +			      WRITE_BITMAP_QUIET, PARSE_OPT_HIDDEN),

The receiving end of this communication is pretty easy to follow.
I'd have named an option to trigger "if possible" behaviour after
that "if possible" phrase and not "quiet", but this is entirely
internal that it does not matter.

> diff --git a/builtin/repack.c b/builtin/repack.c
> index 30982ed2a2..db93ca3660 100644
> --- a/builtin/repack.c
> +++ b/builtin/repack.c
> @@ -345,13 +345,14 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
>  		die(_("--keep-unreachable and -A are incompatible"));
>  
>  	if (write_bitmaps < 0) {
> -		write_bitmaps = (pack_everything & ALL_INTO_ONE) &&
> -				 is_bare_repository() &&
> -				 keep_pack_list.nr == 0 &&
> -				 !has_pack_keep_file();
> +		if (!(pack_everything & ALL_INTO_ONE) ||
> +		    !is_bare_repository() ||
> +		    keep_pack_list.nr != 0 ||
> +		    has_pack_keep_file())
> +			write_bitmaps = 0;

This side of communication is a bit harder to follow, but not
impossible ;-) We leave it "negative" to signal "the user did not
specify, but we enabled it by default" here.

>  	}
>  	if (pack_kept_objects < 0)
> -		pack_kept_objects = write_bitmaps;
> +		pack_kept_objects = !!write_bitmaps;

And non-zero write_bitmaps replaces "true" in the older world.

>  	if (write_bitmaps && !(pack_everything & ALL_INTO_ONE))

So this does not have to change.

>  		die(_(incremental_bitmap_conflict_error));
> @@ -375,8 +376,10 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
>  	argv_array_push(&cmd.args, "--indexed-objects");
>  	if (repository_format_partial_clone)
>  		argv_array_push(&cmd.args, "--exclude-promisor-objects");
> -	if (write_bitmaps)
> +	if (write_bitmaps > 0)
>  		argv_array_push(&cmd.args, "--write-bitmap-index");
> +	else if (write_bitmaps < 0)
> +		argv_array_push(&cmd.args, "--write-bitmap-index-quiet");

And "enabled by user" and "enabled by default" are mapped to the two
options.

All makes sense.

Thanks.

  reply	other threads:[~2019-07-31 20:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-26  2:18 Warnings in gc.log can prevent gc --auto from running Gregory Szorc
2019-07-29 10:07 ` Jeff King
2019-07-29 12:50   ` Ævar Arnfjörð Bjarmason
2019-07-31  4:28     ` Jeff King
2019-07-31  5:37       ` [PATCH 0/3] handling warnings due to auto-enabled bitmaps Jeff King
2019-07-31  5:37         ` [PATCH 1/3] t7700: clean up .keep file in bitmap-writing test Jeff King
2019-07-31  5:39         ` [PATCH 2/3] repack: silence warnings when auto-enabled bitmaps cannot be built Jeff King
2019-07-31 20:26           ` Junio C Hamano [this message]
2019-07-31 21:11             ` Jeff King
2019-07-31  5:40         ` [PATCH 3/3] repack: simplify handling of auto-bitmaps and .keep files Jeff King
2019-07-31 22:34           ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqqftmmosrf.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=avarab@gmail.com \
    --cc=e@80x24.org \
    --cc=git@vger.kernel.org \
    --cc=gregory.szorc@gmail.com \
    --cc=peff@peff.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).