diff options
| author | Lukas Fleischer | 2015-03-05 12:58:12 +0100 |
|---|---|---|
| committer | Jason A. Donenfeld | 2015-03-05 15:54:47 +0100 |
| commit | 3cb8e762780cb4bd8dc9d330d549e36d65ad4335 (patch) | |
| tree | 0bcfe991b4b50f4df2e98f6b61bfd6a66681d6f1 | |
| parent | 4d8ed337cb07121cdd6d0041565cf741a9be526a (diff) | |
| download | cgit-3cb8e762780cb4bd8dc9d330d549e36d65ad4335.tar.gz cgit-3cb8e762780cb4bd8dc9d330d549e36d65ad4335.tar.bz2 cgit-3cb8e762780cb4bd8dc9d330d549e36d65ad4335.zip | |
Drop return value from parse_user()
In commit 936295c (Simplify commit and tag parsing, 2015-03-03), the
commit and tag parsing code was refactored. This broke tag messages in
ui-tag since the line after the tagger header was erroneously skipped.
Rework parse_user() and skip the line manually outside parse_user().
Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
| -rw-r--r-- | parsing.c | 18 |
1 files changed, 7 insertions, 11 deletions
| @@ -69,13 +69,12 @@ static char *substr(const char *head, const char *tail) | |||
| 69 | return buf; | 69 | return buf; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | static const char *parse_user(const char *t, char **name, char **email, unsigned long *date) | 72 | static void parse_user(const char *t, char **name, char **email, unsigned long *date) |
| 73 | { | 73 | { |
| 74 | const char *line_end = strchrnul(t, '\n'); | ||
| 75 | struct ident_split ident; | 74 | struct ident_split ident; |
| 76 | unsigned email_len; | 75 | unsigned email_len; |
| 77 | 76 | ||
| 78 | if (!split_ident_line(&ident, t, line_end - t)) { | 77 | if (!split_ident_line(&ident, t, strchrnul(t, '\n') - t)) { |
| 79 | *name = substr(ident.name_begin, ident.name_end); | 78 | *name = substr(ident.name_begin, ident.name_end); |
| 80 | 79 | ||
| 81 | email_len = ident.mail_end - ident.mail_begin; | 80 | email_len = ident.mail_end - ident.mail_begin; |
| @@ -85,11 +84,6 @@ static const char *parse_user(const char *t, char **name, char **email, unsigned | |||
| 85 | if (ident.date_begin) | 84 | if (ident.date_begin) |
| 86 | *date = strtoul(ident.date_begin, NULL, 10); | 85 | *date = strtoul(ident.date_begin, NULL, 10); |
| 87 | } | 86 | } |
| 88 | |||
| 89 | if (*line_end) | ||
| 90 | return line_end + 1; | ||
| 91 | else | ||
| 92 | return line_end; | ||
| 93 | } | 87 | } |
| 94 | 88 | ||
| 95 | #ifdef NO_ICONV | 89 | #ifdef NO_ICONV |
| @@ -152,13 +146,15 @@ struct commitinfo *cgit_parse_commit(struct commit *commit) | |||
| 152 | p += sha1hex_len + 1; | 146 | p += sha1hex_len + 1; |
| 153 | 147 | ||
| 154 | if (p && skip_prefix(p, "author ", &p)) { | 148 | if (p && skip_prefix(p, "author ", &p)) { |
| 155 | p = parse_user(p, &ret->author, &ret->author_email, | 149 | parse_user(p, &ret->author, &ret->author_email, |
| 156 | &ret->author_date); | 150 | &ret->author_date); |
| 151 | p = next_header_line(p); | ||
| 157 | } | 152 | } |
| 158 | 153 | ||
| 159 | if (p && skip_prefix(p, "committer ", &p)) { | 154 | if (p && skip_prefix(p, "committer ", &p)) { |
| 160 | p = parse_user(p, &ret->committer, &ret->committer_email, | 155 | parse_user(p, &ret->committer, &ret->committer_email, |
| 161 | &ret->committer_date); | 156 | &ret->committer_date); |
| 157 | p = next_header_line(p); | ||
| 162 | } | 158 | } |
| 163 | 159 | ||
| 164 | if (p && skip_prefix(p, "encoding ", &p)) { | 160 | if (p && skip_prefix(p, "encoding ", &p)) { |
| @@ -211,7 +207,7 @@ struct taginfo *cgit_parse_tag(struct tag *tag) | |||
| 211 | 207 | ||
| 212 | for (p = data; !end_of_header(p); p = next_header_line(p)) { | 208 | for (p = data; !end_of_header(p); p = next_header_line(p)) { |
| 213 | if (skip_prefix(p, "tagger ", &p)) { | 209 | if (skip_prefix(p, "tagger ", &p)) { |
| 214 | p = parse_user(p, &ret->tagger, &ret->tagger_email, | 210 | parse_user(p, &ret->tagger, &ret->tagger_email, |
| 215 | &ret->tagger_date); | 211 | &ret->tagger_date); |
| 216 | } | 212 | } |
| 217 | } | 213 | } |
