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

[PATCH] pretend-sha1: grave bugfix.

From
Junio C Hamano <junkio@cox.net>
Date
Feb 16, 2007, 01:16 UTC
Message-ID
<7v3b56dhr1.fsf@assigned-by-dhcp.cox.net>

We stashed away objects that we pretend to have, but did not save the actual data.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 * I wonder how recent merge-recursive with multiple merge bases
   (or an empty one) ever worked with this bug.  Am I
   hallucinating?
 sha1_file.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/sha1_file.c b/sha1_file.c
index b83f59f..2c87031 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1545,11 +1545,13 @@ int pretend_sha1_file(void *buf, unsigned long len, const char *type, unsigned c
 	co = &cached_objects[cached_object_nr++];
 	co->size = len;
 	co->type = strdup(type);
+	co->buf = xmalloc(len);
+	memcpy(co->buf, buf, len);
 	hashcpy(co->sha1, sha1);
 	return 0;
 }
 
-void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size)
+void *read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size)
 {
 	unsigned long mapsize;
 	void *map, *buf;
-- 
1.5.0.31.g78e90
Next: Johannes Schindelin
Message 1 of 4 in “pretend-sha1: grave bugfix.”
  1. pretend-sha1: grave bugfix.Junio C Hamano, Feb 16, 2007
  2. Johannes SchindelinFeb 16, 2007
  3. Shawn O. PearceFeb 16, 2007
  4. Junio C HamanoFeb 16, 2007

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.