[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    Re: I have gone and done a bad thing - malformed tree objects
From:       Jeff King <peff () peff ! net>
Date:       2020-07-31 23:15:21
Message-ID: 20200731231521.GB1461090 () coredump ! intra ! peff ! net
[Download RAW message or body]

On Fri, Jul 31, 2020 at 07:05:42PM -0400, Jason Pyeron wrote:

> > If the cruft has already been stored in a packfile, then prune would
> > not touch it.  "git repack -a -d && git prune --expire=now" would be
> > the next thing to do.
> 
> $ git repack -a -d && git prune --expire=now
> Enumerating objects: 327236, done.
> Counting objects: 100% (327125/327125), done.
> Delta compression using up to 8 threads
> Compressing objects: 100% (104728/104728), done.
> Writing objects: 100% (327125/327125), done.
> Total 327125 (delta 205244), reused 326116 (delta 204678), pack-reused 0
> 
> $ git cat-file --batch-all-objects --batch=objecttype
> fatal: object 00009623a06b8dea7c151542fc789539599c07d0 changed type!?

That should be dropping everything that isn't reachable. I'd suggest to
expire reflogs, though it looks like you've also tried "git gc" with
reflog expiration. Does removing .git/logs entirely help?

If not, are you sure it isn't actually reachable from your history? What
does:

  git rev-list --all --objects | grep 00009623a06

say? If no hits, does adding --reflogs to the command-line change it?

We also consider blobs in the index reachable. I don't recall offhand
whether that applies to trees mentioned by the cache-trees extension. I
don't _think_ that would apply to your broken tree, since they'd have
been generated by Git itself, but possibly removing .git/index (if this
isn't a bare repo) would help?

-Peff
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic