git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "Stefan Näwe" <stefan.naewe@atlas-elektronik.com>
Cc: Git list <git@vger.kernel.org>
Subject: Re: git gc gives "error: Could not read..."
Date: Mon, 1 Jun 2015 04:52:26 -0400	[thread overview]
Message-ID: <20150601085226.GA20537@peff.net> (raw)
In-Reply-To: <556C1A95.9010704@atlas-elektronik.com>

On Mon, Jun 01, 2015 at 10:40:53AM +0200, Stefan Näwe wrote:

> Turns out to be a tree:
> 
> tree 7713c3b1e9ea2dd9126244697389e4000bb39d85
> parent d7acfc22fbc0fba467d82f41c90aab7d61f8d751
> author Stefan Naewe <stefan.naewe@atlas-elektronik.com> 1429536806 +0200
> committer Stefan Naewe <stefan.naewe@atlas-elektronik.com> 1429536806 +0200

Yeah, I bungled the grep earlier. That message can come from a missing
tag, tree, or commit object. But I think the root cause is the same.

> Not exactly. My msysgit is merge-rebase'd (or rebase-merge'd...) onto v2.2.0...
> I'll try older versions (pre v2.2.0) on linux.

OK, that makes more sense then.

> I also cloned from local filesystem (widnows drive) to a samba share.

And that, too.

I've managed to create a small test case that replicates the problem:

diff --git a/t/t6501-freshen-objects.sh b/t/t6501-freshen-objects.sh
index 157f3f9..015b0da 100755
--- a/t/t6501-freshen-objects.sh
+++ b/t/t6501-freshen-objects.sh
@@ -129,4 +129,19 @@ for repack in '' true; do
 	'
 done
 
+test_expect_failure 'do not complain about existing broken links' '
+	cat >broken-commit <<-\EOF &&
+	tree 0000000000000000000000000000000000000001
+	parent 0000000000000000000000000000000000000002
+	author whatever <whatever@example.com> 1234 -0000
+	committer whatever <whatever@example.com> 1234 -0000
+
+	some message
+	EOF
+	commit=$(git hash-object -t commit -w broken-commit) &&
+	git gc 2>stderr &&
+	verbose git cat-file -e $commit &&
+	test_must_be_empty stderr
+'
+
 test_done

which produces:

  'stderr' is not empty, it contains:
  error: Could not read 0000000000000000000000000000000000000002
  error: Could not read 0000000000000000000000000000000000000001
  error: Could not read 0000000000000000000000000000000000000002
  error: Could not read 0000000000000000000000000000000000000001

Unfortunately the fix is a little bit invasive. I'll send something out
in a few minutes.

-Peff

  reply	other threads:[~2015-06-01  8:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01  7:37 git gc gives "error: Could not read..." Stefan Näwe
2015-06-01  8:14 ` Jeff King
2015-06-01  8:40   ` Stefan Näwe
2015-06-01  8:52     ` Jeff King [this message]
2015-06-01  9:14       ` Stefan Näwe
2015-06-01  9:58         ` Jeff King
2015-06-01 10:08           ` Stefan Näwe
2015-06-01 10:22             ` Jeff King
2015-06-01  9:54       ` [RFC/PATCH 0/3] silence missing-link warnings in some cases Jeff King
2015-06-01  9:56         ` [PATCH 1/3] add quieter versions of parse_{tree,commit} Jeff King
2015-06-01  9:56         ` [PATCH 2/3] silence broken link warnings with revs->ignore_missing_links Jeff King
2015-06-01  9:56         ` [PATCH 3/3] suppress errors on missing UNINTERESTING links Jeff King
2015-06-01 15:03         ` [RFC/PATCH 0/3] silence missing-link warnings in some cases Junio C Hamano
2015-06-01 15:41           ` Jeff King
2015-06-01 16:11             ` 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

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

  git send-email \
    --in-reply-to=20150601085226.GA20537@peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=stefan.naewe@atlas-elektronik.com \
    /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 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 NNTP newsgroup(s).