* [PATCH] parse_object: pass on the original sha1, not the replaced one
@ 2010-09-02 21:13 Christian Couder
2010-09-02 23:24 ` Nguyen Thai Ngoc Duy
0 siblings, 1 reply; 3+ messages in thread
From: Christian Couder @ 2010-09-02 21:13 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Nguyen Thai Ngoc Duy
From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= <pclouds@gmail.com>
Commit 0e87c36 (object: call "check_sha1_signature" with the
replacement sha1) changed the first argument passed to
parse_object_buffer() from "sha1" to "repl". With that change,
the returned obj pointer has the replacement SHA1 in obj->sha1,
not the original one.
But when using lookup_commit() and then parse_commit() on a
commit, we get an object pointer with the original sha1, but
the commit content comes from the replacement commit.
So the result we get from using parse_object() is different
from the we get from using lookup_commit() followed by
parse_commit().
It looks much simpler and safer to fix this inconsistency by
passing "sha1" to parse_object_bufer() instead of "repl".
The commit comment should be used to tell the the replacement
commit is replacing another commit and why. So it should be
easy to see that we have a replacement commit instead of an
original one.
And it is not a problem if the content of the commit is not
consistent with the sha1 as cat-file piped to hash-object can
be used to see the difference.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
Since no one resent the original patch with an improved commit
message, here is my try.
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.2.2.417.g10a17
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] parse_object: pass on the original sha1, not the replaced one
2010-09-02 21:13 [PATCH] parse_object: pass on the original sha1, not the replaced one Christian Couder
@ 2010-09-02 23:24 ` Nguyen Thai Ngoc Duy
2010-09-03 4:37 ` Christian Couder
0 siblings, 1 reply; 3+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2010-09-02 23:24 UTC (permalink / raw)
To: Christian Couder; +Cc: Junio C Hamano, git
On Fri, Sep 3, 2010 at 7:13 AM, Christian Couder
<chriscool@tuxfamily.org> wrote:
> Since no one resent the original patch with an improved commit
> message, here is my try.
My bad. I forgot something again. I will think of something to
demonstrate this. By the way, it breaks t6050.14, bisect and
replacements.
--
Duy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] parse_object: pass on the original sha1, not the replaced one
2010-09-02 23:24 ` Nguyen Thai Ngoc Duy
@ 2010-09-03 4:37 ` Christian Couder
0 siblings, 0 replies; 3+ messages in thread
From: Christian Couder @ 2010-09-03 4:37 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy; +Cc: Junio C Hamano, git
On Friday 03 September 2010 01:24:07 Nguyen Thai Ngoc Duy wrote:
> On Fri, Sep 3, 2010 at 7:13 AM, Christian Couder
>
> <chriscool@tuxfamily.org> wrote:
> > Since no one resent the original patch with an improved commit
> > message, here is my try.
>
> My bad. I forgot something again. I will think of something to
> demonstrate this. By the way, it breaks t6050.14, bisect and
> replacements.
Ooops, yeah, I will have a look at this.
Thanks,
Christian.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-09-03 4:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-02 21:13 [PATCH] parse_object: pass on the original sha1, not the replaced one Christian Couder
2010-09-02 23:24 ` Nguyen Thai Ngoc Duy
2010-09-03 4:37 ` Christian Couder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).