Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Keep the parents in order when parsing commits
author
Linus Torvalds
<torvalds@ppc970.osdl.org>
Tue, 21 Jun 2005 03:26:03 +0000
(20:26 -0700)
committer
Linus Torvalds
<torvalds@ppc970.osdl.org>
Tue, 21 Jun 2005 03:26:03 +0000
(20:26 -0700)
We used to keep the parents in reverse order in the commit_list. Most
users don't care, but it's wrong, and the next commit does care.
commit.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (from parent 1:
9d73fad
)
diff --git
a/commit.c
b/commit.c
index 60047a06d376d4f1144af6a14efc059cec5d2843..738590f31a397da0e398db3d350d29aff797965c 100644
(file)
--- a/
commit.c
+++ b/
commit.c
@@
-63,6
+63,7
@@
int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size)
{
void *bufptr = buffer;
unsigned char parent[20];
{
void *bufptr = buffer;
unsigned char parent[20];
+ struct commit_list **pptr;
if (item->object.parsed)
return 0;
if (item->object.parsed)
return 0;
@@
-72,11
+73,12
@@
int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size)
if (item->tree)
add_ref(&item->object, &item->tree->object);
bufptr += 46; /* "tree " + "hex sha1" + "\n" */
if (item->tree)
add_ref(&item->object, &item->tree->object);
bufptr += 46; /* "tree " + "hex sha1" + "\n" */
+ pptr = &item->parents;
while (!memcmp(bufptr, "parent ", 7) &&
!get_sha1_hex(bufptr + 7, parent)) {
struct commit *new_parent = lookup_commit(parent);
if (new_parent) {
while (!memcmp(bufptr, "parent ", 7) &&
!get_sha1_hex(bufptr + 7, parent)) {
struct commit *new_parent = lookup_commit(parent);
if (new_parent) {
-
commit_list_insert(new_parent, &item->parents)
;
+
pptr = &commit_list_insert(new_parent, pptr)->next
;
add_ref(&item->object, &new_parent->object);
}
bufptr += 48;
add_ref(&item->object, &new_parent->object);
}
bufptr += 48;