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

[PATCH RFC] parse_object: pass on the original sha1, not the replaced one

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Jul 31, 2010, 12:36 UTC
Message-ID
<1280579802-8606-1-git-send-email-pclouds@gmail.com>

Commit 0e87c36 (object: call "check_sha1_signature" with the replacement sha1) did this. I'm not sure if it's should be done this way.

With "repl" as the first argument to parse_object_buffer, the returned obj pointer will have the replaced SHA1 in obj->sha1, not the original one. I sort of expect that, no matter the object is replaced, obj->sha1 should stay the same.

This was observed by replacing commit tip. git log would show the
replaced sha1, not the original one.
---
 object.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/object.c b/object.c
index 277b3dd..7adfda7 100644
--- a/object.c
+++ b/object.c
@@ -199,7 +199,7 @@ struct object *parse_object(const unsigned char *sha1)
 			return NULL;
 		}
 
-		obj = parse_object_buffer(repl, type, size, buffer, &eaten);
+		obj = parse_object_buffer(sha1, type, size, buffer, &eaten);
 		if (!eaten)
 			free(buffer);
 		return obj;
-- 
1.7.1.rc1.69.g24c2f7
Next: Christian Couder
Message 1 of 14 in “parse_object: pass on the original sha1, not the replaced one”
  1. parse_object: pass on the original sha1, not the replaced oneNguyễn Thái Ngọc Duy, Jul 31, 2010
  2. Christian CouderAug 2, 2010
  3. Nguyen Thai Ngoc DuyAug 2, 2010
  4. Christian CouderAug 3, 2010
  5. Nguyen Thai Ngoc DuyAug 3, 2010
  6. Christian CouderAug 4, 2010
  7. Nguyen Thai Ngoc DuyAug 4, 2010
  8. Christian CouderAug 4, 2010
  9. Nguyen Thai Ngoc DuyAug 4, 2010
  10. Christian CouderAug 5, 2010
  11. Nguyen Thai Ngoc DuyAug 7, 2010
  12. Christian CouderAug 13, 2010
  13. Nguyen Thai Ngoc DuyAug 13, 2010
  14. Christian CouderAug 14, 2010

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.