X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=commit.c;h=213bc98c183b820c43c66d67a15133b4a401f6a4;hb=20c8cde45656fc187e06088ef5baf0bbdfdf70bd;hp=0ea441d13b1430231f30d9524aed88b9719290b6;hpb=e6d29a4b47cf476e18658609033bdee4c42db3b8;p=~andy%2Fgit diff --git a/commit.c b/commit.c index 0ea441d13..213bc98c1 100644 --- a/commit.c +++ b/commit.c @@ -9,6 +9,8 @@ #include "gpg-interface.h" #include "mergesort.h" +static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **); + int save_commit_buffer = 1; const char *commit_type = "commit"; @@ -607,6 +609,7 @@ static struct commit *interesting(struct commit_list *list) return NULL; } +/* all input commits in one and twos[] must have been parsed! */ static struct commit_list *paint_down_to_common(struct commit *one, int n, struct commit **twos) { struct commit_list *list = NULL; @@ -615,6 +618,8 @@ static struct commit_list *paint_down_to_common(struct commit *one, int n, struc one->object.flags |= PARENT1; commit_list_insert_by_date(one, &list); + if (!n) + return list; for (i = 0; i < n; i++) { twos[i]->object.flags |= PARENT2; commit_list_insert_by_date(twos[i], &list); @@ -735,6 +740,8 @@ static int remove_redundant(struct commit **array, int cnt) redundant = xcalloc(cnt, 1); filled_index = xmalloc(sizeof(*filled_index) * (cnt - 1)); + for (i = 0; i < cnt; i++) + parse_commit(array[i]); for (i = 0; i < cnt; i++) { struct commit_list *common; @@ -1073,8 +1080,9 @@ static int excluded_header_field(const char *field, size_t len, const char **exc return 0; } -struct commit_extra_header *read_commit_extra_header_lines(const char *buffer, size_t size, - const char **exclude) +static struct commit_extra_header *read_commit_extra_header_lines( + const char *buffer, size_t size, + const char **exclude) { struct commit_extra_header *extra = NULL, **tail = &extra, *it = NULL; const char *line, *next, *eof, *eob;