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

Re: Reading commit objects

From
Chico Sokol <chico.sokol@gmail.com>
Date
May 22, 2013, 14:25 UTC
Message-ID
<CABx5MBSmCN=avRDCJ+RU8FoRDaGG=6uRfTdVR9m3A=SqpuKAjQ@mail.gmail.com>
In-Reply-To
<CAJo=hJtqACW+CR5FkmDfwyK1Wg3Kcppy6DbW7P=On_qJyvsYvQ@mail.gmail.com>
Show 6 quoted lines
> Your code is broken. IOUtils is probably corrupting what you get back.
> After inflating the stream you should see the object type ("commit"),
> space, its length in bytes as a base 10 string, and then a NUL ('\0').
> Following that is the tree line, and parent(s) if any. I wonder if
> IOUtils discarded the remainder of the line after the NUL and did not
> consider the tree line.
Maybe you're right, Shawn. I've also tried the following code:

File dotGit = new File("objects/25/0f67ef017fcb97b5371a302526872cfcadad21"); InflaterInputStream inflaterInputStream = new InflaterInputStream(new FileInputStream(dotGit)); ByteArrayOutputStream os = new ByteArrayOutputStream(); IOUtils.copyLarge(inflaterInputStream, os); System.out.println(new String(os.toByteArray()));

But we got the same result, I'll try to read the bytes by myself (without apache IOUtils). Is the contents of a unpacked object utf-8 encoded?

Previous: Shawn PearceNext: Chico Sokol
Message 16 of 19 in “Reading commit objects”
  1. Chico SokolMay 21, 2013
  2. Felipe ContrerasMay 21, 2013
  3. John SzakmeisterMay 21, 2013
  4. Chico SokolMay 21, 2013
  5. Junio C HamanoMay 21, 2013
  6. Chico SokolMay 21, 2013
  7. Jonathan NiederMay 21, 2013
  8. Shawn PearceMay 22, 2013
  9. java zlib woes (was: Reading commit objects)Andreas Krey, May 22, 2013
  10. Shawn PearceMay 22, 2013
  11. Andreas KreyMay 27, 2013
  12. fetch delta resolution vs. checkout (was: java zlib woes)Andreas Krey, Jun 4, 2013
  13. Shawn PearceMay 22, 2013
  14. Chico SokolMay 22, 2013
  15. Shawn PearceMay 22, 2013
  16. Chico SokolMay 22, 2013
  17. Chico SokolMay 22, 2013
  18. Shawn PearceMay 22, 2013
  19. Junio C HamanoMay 21, 2013

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.