All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, Michael Haggerty <mhagger@alum.mit.edu>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH 3/6] fsck: prepare dummy objects for --connectivity-check
Date: Tue, 17 Jan 2017 13:15:57 -0800	[thread overview]
Message-ID: <xmqqa8ape6b6.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170116213204.e7ykwowqzafkexqd@sigill.intra.peff.net> (Jeff King's message of "Mon, 16 Jan 2017 16:32:04 -0500")

Jeff King <peff@peff.net> writes:

> +static void mark_object_for_connectivity(const unsigned char *sha1)
> +{
> +	struct object *obj = lookup_object(sha1);
> +
> +	/*
> +	 * Setting the object type here isn't strictly necessary here for a
> +	 * connectivity check.

Drop one of these "here"s?


> The cmd_fsck() part of the diff is pretty nasty without
> "-b".

True.  I also wonder if swapping the if/else arms make the end
result and the patch easier to read. i.e.

+	if (connectivity_only) {
+		mark loose for connectivity;
+		mark packed for connectivity;
+	} else {
		... existing code comes here reindented ...
	}                

But the patch makes sense.

> diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
> index e88ec7747..c1b2dda33 100755
> --- a/t/t1450-fsck.sh
> +++ b/t/t1450-fsck.sh
> @@ -523,9 +523,21 @@ test_expect_success 'fsck --connectivity-only' '
>  		touch empty &&
>  		git add empty &&
>  		test_commit empty &&
> +
> +		# Drop the index now; we want to be sure that we
> +		# recursively notice that we notice the broken objects
> +		# because they are reachable from refs, not because
> +		# they are in the index.
> +		rm -f .git/index &&
> +
> +		# corrupt the blob, but in a way that we can still identify
> +		# its type. That lets us see that --connectivity-only is
> +		# not actually looking at the contents, but leaves it
> +		# free to examine the type if it chooses.
>  		empty=.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 &&
> -		rm -f $empty &&
> -		echo invalid >$empty &&
> +		blob=$(echo unrelated | git hash-object -w --stdin) &&
> +		mv $(sha1_file $blob) $empty &&
> +
>  		test_must_fail git fsck --strict &&
>  		git fsck --strict --connectivity-only &&
>  		tree=$(git rev-parse HEAD:) &&
> @@ -537,6 +549,13 @@ test_expect_success 'fsck --connectivity-only' '
>  	)
>  '
>  
> +test_expect_success 'fsck --connectivity-only with explicit head' '
> +	(
> +		cd connectivity-only &&
> +		test_must_fail git fsck --connectivity-only $tree
> +	)
> +'

Most of the earlier "tree=..." assignments are done in subshells,
and it is not clear which tree this refers to.  Is this the one that
was written in 'rev-list --verify-objects with bad sha1' that has
been removed in its when-finished handler?

>  remove_loose_object () {
>  	sha1="$(git rev-parse "$1")" &&
>  	remainder=${sha1#??} &&

  reply	other threads:[~2017-01-17 21:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-16 21:22 [PATCH 0/6] fsck --connectivity-check misses some corruption Jeff King
2017-01-16 21:24 ` [PATCH 1/6] t1450: clean up sub-objects in duplicate-entry test Jeff King
2017-01-17 20:52   ` Junio C Hamano
2017-01-17 20:53     ` Jeff King
2017-01-16 21:25 ` [PATCH 2/6] fsck: report trees as dangling Jeff King
2017-01-17 20:57   ` Junio C Hamano
2017-01-16 21:32 ` [PATCH 3/6] fsck: prepare dummy objects for --connectivity-check Jeff King
2017-01-17 21:15   ` Junio C Hamano [this message]
2017-01-17 21:32     ` Jeff King
2017-01-17 21:16   ` Junio C Hamano
2017-01-16 21:33 ` [PATCH 4/6] fsck: tighten error-checks of "git fsck <head>" Jeff King
2017-01-17 21:17   ` Junio C Hamano
2017-01-16 21:34 ` [PATCH 5/6] fsck: do not fallback "git fsck <bogus>" to "git fsck" Jeff King
2017-01-16 21:34 ` [PATCH 6/6] fsck: check HAS_OBJ more consistently Jeff King
2017-01-16 23:26 ` [PATCH 0/6] fsck --connectivity-check misses some corruption Jeff King

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

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

  git send-email \
    --in-reply-to=xmqqa8ape6b6.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=mhagger@alum.mit.edu \
    --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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.