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

Re: [PATCH] index-pack: never prune base_cache.

From
Björn Steinbrink <b.steinbrink@gmx.de>
Date
Jul 23, 2008, 13:44 UTC
Message-ID
<20080723134448.GB11679@atjola.homenet>
In-Reply-To
<alpine.DEB.1.00.0807231407040.8986@racer>
On 2008.07.23 14:09:40 +0100, Johannes Schindelin wrote:
Show 16 quoted lines
> Hi,
> 
> On Wed, 23 Jul 2008, Björn Steinbrink wrote:
> 
> > On 2008.07.23 14:11:18 +0200, Pierre Habouzit wrote:
> > > It may belong to something (stdin) that is consumed.
> > 
> > Probably thanks to me, babbling about stdin without having a clue what 
> > I'm talking about, that rationale is wrong.
> > 
> > We may not prune base_cache since that object might come from a
> > different pack than the one that we are processing. In such a case, we
> > would try to restore the data for that object from the pack we're
> > processing and fail miserably.
> 
> Then the proper fix would be to load the object from that pack again.

Actually, my analysis was total bullshit. Right after reading the object from the foreign pack, we also call append_obj_to_pack, so we are actually able to reread that object just fine. The real issue seems to be that we just forget to initialize some fields.

This patch fixes the issue for me, but I guess it's not quite the right way to do it, pure guesswork.

Björn
---
diff --git a/index-pack.c b/index-pack.c
index ac20a46..33ba8ef 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -699,6 +699,9 @@ static struct object_entry *append_obj_to_pack(
 	write_or_die(output_fd, header, n);
 	obj[0].idx.crc32 = crc32(0, Z_NULL, 0);
 	obj[0].idx.crc32 = crc32(obj[0].idx.crc32, header, n);
+	obj[0].hdr_size = n;
+	obj[0].type = type;
+	obj[0].size = size;
 	obj[1].idx.offset = obj[0].idx.offset + n;
 	obj[1].idx.offset += write_compressed(output_fd, buf, size, &obj[0].idx.crc32);
 	hashcpy(obj->idx.sha1, sha1);
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 22 of 24 in “regression in 92392b4”
  1. Pierre HabouzitJul 22, 2008
  2. Johannes SchindelinJul 22, 2008
  3. Shawn O. PearceJul 23, 2008
  4. Johannes SchindelinJul 23, 2008
  5. Pierre HabouzitJul 23, 2008
  6. Johannes SchindelinJul 23, 2008
  7. Pierre HabouzitJul 22, 2008
  8. Björn SteinbrinkJul 23, 2008
  9. Pierre HabouzitJul 23, 2008
  10. Pierre HabouzitJul 23, 2008
  11. Johannes SchindelinJul 23, 2008
  12. Björn SteinbrinkJul 23, 2008
  13. Pierre HabouzitJul 23, 2008
  14. Johannes SchindelinJul 23, 2008
  15. Pierre HabouzitJul 23, 2008
  16. Björn SteinbrinkJul 23, 2008
  17. index-pack: never prune base_cache.Pierre Habouzit, Jul 23, 2008
  18. Björn SteinbrinkJul 23, 2008
  19. Johannes SchindelinJul 23, 2008
  20. Pierre HabouzitJul 23, 2008
  21. Johannes SchindelinJul 23, 2008
  22. Björn SteinbrinkJul 23, 2008
  23. Johannes SchindelinJul 23, 2008
  24. Pierre HabouzitJul 23, 2008

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.