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

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Sat, 31 Jul 2010 19:36:42 +0700

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