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

Re: git gc gives "error: Could not read..."

From
Stefan Näwe <stefan.naewe@atlas-elektronik.com>
Date
Jun 1, 2015, 09:14 UTC
Message-ID
<556C2273.4030405@atlas-elektronik.com>
In-Reply-To
<20150601085226.GA20537@peff.net>
Am 01.06.2015 um 10:52 schrieb Jeff King:
Show 11 quoted lines
> 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.
Maybe this one:
   d3038d (prune: keep objects reachable from recent objects)

?? That's what 'git bisect' told me.

Show 46 quoted lines
>> 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.

It would be really helpful if you sent the patch as an attachment. I know that's not the normal wokflow but our mail server garbles every message so that I can't (or don't know how to...) use 'git am' to test the patch, which I'm willing to do!

Thanks,
  Stefan
-- 
----------------------------------------------------------------
/dev/random says: The cost of feathers has risen... Now even DOWN is up!
python -c "print '73746566616e2e6e616577654061746c61732d656c656b74726f6e696b2e636f6d'.decode('hex')" 
GPG Key fingerprint = 2DF5 E01B 09C3 7501 BCA9  9666 829B 49C5 9221 27AF
Previous: Jeff KingNext: Jeff King
Message 5 of 15 in “git gc gives "error: Could not read..."”
  1. Stefan NäweJun 1, 2015
  2. Jeff KingJun 1, 2015
  3. Stefan NäweJun 1, 2015
  4. Jeff KingJun 1, 2015
  5. Stefan NäweJun 1, 2015
  6. Jeff KingJun 1, 2015
  7. Stefan NäweJun 1, 2015
  8. Jeff KingJun 1, 2015
  9. 0/3 silence missing-link warnings in some casesJeff King, Jun 1, 2015
  10. 1/3 add quieter versions of parse_{tree,commit}Jeff King, Jun 1, 2015
  11. 2/3 silence broken link warnings with revs->ignore_missing_linksJeff King, Jun 1, 2015
  12. 3/3 suppress errors on missing UNINTERESTING linksJeff King, Jun 1, 2015
  13. Junio C HamanoJun 1, 2015
  14. Jeff KingJun 1, 2015
  15. Junio C HamanoJun 1, 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.