diff options
| author | 2011-03-26 23:22:35 (JST) | |
|---|---|---|
| committer | 2011-03-26 23:22:35 (JST) | |
| commit | 568d8d3fd3f5a3b4207887215c8adcbac2bb9552 (patch) | |
| tree | b593858c82264a4e24d9051335b1a26b8bd0ebd7 | |
| parent | 2e6721edbb3c94a70f4ef0ead5e55b9da19fb806 (diff) | |
| parent | facca560d903351ddf1b8a41faafcd1f76de5c7c (diff) | |
| download | cgit-568d8d3fd3f5a3b4207887215c8adcbac2bb9552.zip cgit-568d8d3fd3f5a3b4207887215c8adcbac2bb9552.tar.gz | |
Merge branch 'stable'
| -rw-r--r-- | cgitrc.5.txt | 5 | ||||
| -rw-r--r-- | parsing.c | 24 |
2 files changed, 18 insertions, 11 deletions
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index be8483c..65b210f 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
| @@ -287,8 +287,9 @@ scan-path:: | |||
| 287 | the result will be cached as a cgitrc include-file in the cache | 287 | the result will be cached as a cgitrc include-file in the cache |
| 288 | directory. If project-list has been defined prior to scan-path, | 288 | directory. If project-list has been defined prior to scan-path, |
| 289 | scan-path loads only the directories listed in the file pointed to by | 289 | scan-path loads only the directories listed in the file pointed to by |
| 290 | project-list. Default value: none. See also: cache-scanrc-ttl, | 290 | project-list. Be advised that only the global settings taken |
| 291 | project-list. | 291 | before the scan-path directive will be applied to each repository. |
| 292 | Default value: none. See also: cache-scanrc-ttl, project-list. | ||
| 292 | 293 | ||
| 293 | section:: | 294 | section:: |
| 294 | The name of the current repository section - all repositories defined | 295 | The name of the current repository section - all repositories defined |
| @@ -106,7 +106,11 @@ const char *reencode(char **txt, const char *src_enc, const char *dst_enc) | |||
| 106 | if (!txt || !*txt || !src_enc || !dst_enc) | 106 | if (!txt || !*txt || !src_enc || !dst_enc) |
| 107 | return *txt; | 107 | return *txt; |
| 108 | 108 | ||
| 109 | tmp = reencode_string(*txt, src_enc, dst_enc); | 109 | /* no encoding needed if src_enc equals dst_enc */ |
| 110 | if(!strcasecmp(src_enc, dst_enc)) | ||
| 111 | return *txt; | ||
| 112 | |||
| 113 | tmp = reencode_string(*txt, dst_enc, src_enc); | ||
| 110 | if (tmp) { | 114 | if (tmp) { |
| 111 | free(*txt); | 115 | free(*txt); |
| 112 | *txt = tmp; | 116 | *txt = tmp; |
| @@ -160,6 +164,10 @@ struct commitinfo *cgit_parse_commit(struct commit *commit) | |||
| 160 | } | 164 | } |
| 161 | } | 165 | } |
| 162 | 166 | ||
| 167 | /* if no special encoding is found, assume UTF-8 */ | ||
| 168 | if(!ret->msg_encoding) | ||
| 169 | ret->msg_encoding = xstrdup("UTF-8"); | ||
| 170 | |||
| 163 | // skip unknown header fields | 171 | // skip unknown header fields |
| 164 | while (p && *p && (*p != '\n')) { | 172 | while (p && *p && (*p != '\n')) { |
| 165 | p = strchr(p, '\n'); | 173 | p = strchr(p, '\n'); |
| @@ -189,14 +197,12 @@ struct commitinfo *cgit_parse_commit(struct commit *commit) | |||
| 189 | } else | 197 | } else |
| 190 | ret->subject = xstrdup(p); | 198 | ret->subject = xstrdup(p); |
| 191 | 199 | ||
| 192 | if (ret->msg_encoding) { | 200 | reencode(&ret->author, ret->msg_encoding, PAGE_ENCODING); |
| 193 | reencode(&ret->author, PAGE_ENCODING, ret->msg_encoding); | 201 | reencode(&ret->author_email, ret->msg_encoding, PAGE_ENCODING); |
| 194 | reencode(&ret->author_email, PAGE_ENCODING, ret->msg_encoding); | 202 | reencode(&ret->committer, ret->msg_encoding, PAGE_ENCODING); |
| 195 | reencode(&ret->committer, PAGE_ENCODING, ret->msg_encoding); | 203 | reencode(&ret->committer_email, ret->msg_encoding, PAGE_ENCODING); |
| 196 | reencode(&ret->committer_email, PAGE_ENCODING, ret->msg_encoding); | 204 | reencode(&ret->subject, ret->msg_encoding, PAGE_ENCODING); |
| 197 | reencode(&ret->subject, PAGE_ENCODING, ret->msg_encoding); | 205 | reencode(&ret->msg, ret->msg_encoding, PAGE_ENCODING); |
| 198 | reencode(&ret->msg, PAGE_ENCODING, ret->msg_encoding); | ||
| 199 | } | ||
| 200 | 206 | ||
| 201 | return ret; | 207 | return ret; |
| 202 | } | 208 | } |
