From: "Jason Pyeron" <jpyeron@pdinc.us>
To: "'Jeff King'" <peff@peff.net>
Cc: "'Junio C Hamano'" <gitster@pobox.com>, <git@vger.kernel.org>
Subject: RE: I have gone and done a bad thing - malformed tree objects
Date: Sat, 1 Aug 2020 22:50:04 -0400 [thread overview]
Message-ID: <052601d66877$a191c450$e4b54cf0$@pdinc.us> (raw)
In-Reply-To: <20200801014443.GA1464485@coredump.intra.peff.net>
> -----Original Message-----
> From: Jeff King
> Sent: Friday, July 31, 2020 9:45 PM
>
> On Fri, Jul 31, 2020 at 08:01:58PM -0400, Jason Pyeron wrote:
>
> > > 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
> >
> > $ git rev-list --all --objects | grep 00009623a06
> > 00009623a06b8dea7c151542fc789539599c07d0 src/htdocs
> > (it is still running...)
$ git rev-list --all --objects | grep 00009623a06
00009623a06b8dea7c151542fc789539599c07d0 src/htdocs
$ git rev-list --all --objects --reflog | grep 00009623a06
00009623a06b8dea7c151542fc789539599c07d0 src/htdocs
No unexpected results, just the correct tree pointing to the 00009623a06 as a tree.
> >
> > But that is an expected result, I will be back at work on Sunday.
>
> So it sounds like it's still reachable, and you'd need to rewrite
> history to get rid of it. Or is that object OK, and it's a containing
> tree that mentions it with the wrong mode the problem? In that case,
> same question: is the containing tree reachable?
Backing up to the beginning.
There has always been a tree with a tree entry for that blob - which is reachable.
I then created a tree manually, in it I added that tree id as a blob reference when it should have been a tree. (e.g. 100644 blob 00009623a06b8dea7c151542fc789539599c07d0 00009623a06b8dea7c151542fc789539599c07d0.blob)
I realized my mistake, dropped the commit referring to my butchered tree object (reset to new correct commit with correct tree).
The tree I created should no longer be reachable.
$ mv logs logs.bak
$ git cat-file --batch-all-objects --batch=objecttype --unordered --allow-unknown-type
objecttype
fatal: object 00009623a06b8dea7c151542fc789539599c07d0 changed type!?
$ git cat-file -t 00009623a06b8dea7c151542fc789539599c07d0
tree
$ git cat-file -s 00009623a06b8dea7c151542fc789539599c07d0
2375
$ echo -e 'import zlib\nfrom hashlib import sha1\ndecompressed_contents=zlib.decompress(open("objects/00/009623a06b8dea7c151542fc789539599c07d0", "rb").read())\nprint sha1(decompressed_contents).hexdigest()\nprint decompressed_contents[0:19]' | python | hexdump -C
00000000 30 30 30 30 39 36 32 33 61 30 36 62 38 64 65 61 |00009623a06b8dea|
00000010 37 63 31 35 31 35 34 32 66 63 37 38 39 35 33 39 |7c151542fc789539|
00000020 35 39 39 63 30 37 64 30 0a 74 72 65 65 20 32 33 |599c07d0.tree 23|
00000030 37 35 00 31 30 30 36 34 34 20 2e 70 0a |75.100644 .p.|
0000003d
$ git cat-file -p 00009623a06b8dea7c151542fc789539599c07d0 | cut -c -55 | head
100644 blob e465d57c345e2dcb117b5a30f9272b7fc5ec77cd .p
100755 blob 7f16c1d4cbb75cf7bd635970a2588ced6ccea8ad Ap
040000 tree 5261c0a3f3b4c688a082c3c5eaf03f8039bf153c CA
100644 blob 188c0d0541523016352b6851e0f7200c18a372e6 CM
100644 blob c8b040ec356b21fcc06911c544149dc6f5d5b861 CM
100644 blob e441983f0fd4d57fb7bf640de31f728529f12c29 CM
100644 blob fd06c9c6ad662e099341f4e0a05b272c6370e64b CM
100644 blob d433fb05ebca807f4487ae4cecf48ec3b66cce78 CM
100755 blob 4b1b049b83bcc7821a7b62977124bfcaa024d960 CM
040000 tree 150d60813c913ec9a178c4230b18fbda84edc2af RE
prev parent reply other threads:[~2020-08-02 3:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-29 0:47 I have gone and done a bad thing - malformed tree objects Jason Pyeron
2020-07-29 0:52 ` Junio C Hamano
2020-07-29 1:09 ` Jason Pyeron
2020-07-29 18:09 ` Junio C Hamano
2020-07-31 23:05 ` Jason Pyeron
2020-07-31 23:15 ` Jeff King
2020-08-01 0:01 ` Jason Pyeron
2020-08-01 1:44 ` Jeff King
2020-08-02 2:50 ` Jason Pyeron [this message]
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='052601d66877$a191c450$e4b54cf0$@pdinc.us' \
--to=jpyeron@pdinc.us \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).