summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-21 03:26:03 (GMT)
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-21 03:26:03 (GMT)
commit6c88be169881c9223532796bd225e79afaa115e1 (patch)
tree588f29f7768a9109425888297b357d5b771db1e9
parent9d73fad4ca15bc0fffe34ee66aea5b9691ab3d2f (diff)
downloadgit-6c88be169881c9223532796bd225e79afaa115e1.zip
git-6c88be169881c9223532796bd225e79afaa115e1.tar.gz
git-6c88be169881c9223532796bd225e79afaa115e1.tar.bz2
Keep the parents in order when parsing commits
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.
-rw-r--r--commit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/commit.c b/commit.c
index 60047a0..738590f 100644
--- 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];
+ struct commit_list **pptr;
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" */
+ pptr = &item->parents;
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;