Fossil SCM
Fix incorrect parsing of RFC 822 user contact info when exporting to a Git repository as reported by Warren in [forum:/info/29e358909c|forum post 29e358909c].
Commit
9360b66a67086d6421383326904ab470ba4f5a9593124b5b96a956202e3c378b
Parent
93a5d659b350fd9…
1 file changed
+6
+6
| --- src/export.c | ||
| +++ src/export.c | ||
| @@ -1170,10 +1170,11 @@ | ||
| 1170 | 1170 | /* |
| 1171 | 1171 | ** Check for 'fx_' table from previous Git import, otherwise take contact info |
| 1172 | 1172 | ** from user table for <emailaddr> in committer field. If no emailaddr, check |
| 1173 | 1173 | ** if username is in email form, otherwise use generic '[email protected]'. |
| 1174 | 1174 | */ |
| 1175 | + char *zTmp; | |
| 1175 | 1176 | if (db_table_exists("repository", "fx_git")) { |
| 1176 | 1177 | zEmail = db_text(0, "SELECT email FROM fx_git WHERE user=%Q", pMan->zUser); |
| 1177 | 1178 | } else { |
| 1178 | 1179 | zEmail = db_text(0, "SELECT info FROM user WHERE login=%Q", pMan->zUser); |
| 1179 | 1180 | } |
| @@ -1183,10 +1184,15 @@ | ||
| 1183 | 1184 | if (strchr(pMan->zUser, '@') == NULL) { |
| 1184 | 1185 | zEmail = mprintf("%[email protected]", pMan->zUser); |
| 1185 | 1186 | } else { |
| 1186 | 1187 | zEmail = fossil_strdup(pMan->zUser); |
| 1187 | 1188 | } |
| 1189 | + } else if ((zTmp = strchr(zEmail, '<')) != NULL) { | |
| 1190 | + ++zTmp; | |
| 1191 | + char *zTmpEnd = strchr(zTmp, '>'); | |
| 1192 | + *(zTmpEnd) = '\0'; | |
| 1193 | + zEmail = fossil_strdup(zTmp); | |
| 1188 | 1194 | } |
| 1189 | 1195 | fprintf(xCmd, "committer %s <%s> %s +0000\n", pMan->zUser, zEmail, buf); |
| 1190 | 1196 | fossil_free(zEmail); |
| 1191 | 1197 | blob_init(&comment, pMan->zComment, -1); |
| 1192 | 1198 | if( blob_size(&comment)==0 ){ |
| 1193 | 1199 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -1170,10 +1170,11 @@ | |
| 1170 | /* |
| 1171 | ** Check for 'fx_' table from previous Git import, otherwise take contact info |
| 1172 | ** from user table for <emailaddr> in committer field. If no emailaddr, check |
| 1173 | ** if username is in email form, otherwise use generic '[email protected]'. |
| 1174 | */ |
| 1175 | if (db_table_exists("repository", "fx_git")) { |
| 1176 | zEmail = db_text(0, "SELECT email FROM fx_git WHERE user=%Q", pMan->zUser); |
| 1177 | } else { |
| 1178 | zEmail = db_text(0, "SELECT info FROM user WHERE login=%Q", pMan->zUser); |
| 1179 | } |
| @@ -1183,10 +1184,15 @@ | |
| 1183 | if (strchr(pMan->zUser, '@') == NULL) { |
| 1184 | zEmail = mprintf("%[email protected]", pMan->zUser); |
| 1185 | } else { |
| 1186 | zEmail = fossil_strdup(pMan->zUser); |
| 1187 | } |
| 1188 | } |
| 1189 | fprintf(xCmd, "committer %s <%s> %s +0000\n", pMan->zUser, zEmail, buf); |
| 1190 | fossil_free(zEmail); |
| 1191 | blob_init(&comment, pMan->zComment, -1); |
| 1192 | if( blob_size(&comment)==0 ){ |
| 1193 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -1170,10 +1170,11 @@ | |
| 1170 | /* |
| 1171 | ** Check for 'fx_' table from previous Git import, otherwise take contact info |
| 1172 | ** from user table for <emailaddr> in committer field. If no emailaddr, check |
| 1173 | ** if username is in email form, otherwise use generic '[email protected]'. |
| 1174 | */ |
| 1175 | char *zTmp; |
| 1176 | if (db_table_exists("repository", "fx_git")) { |
| 1177 | zEmail = db_text(0, "SELECT email FROM fx_git WHERE user=%Q", pMan->zUser); |
| 1178 | } else { |
| 1179 | zEmail = db_text(0, "SELECT info FROM user WHERE login=%Q", pMan->zUser); |
| 1180 | } |
| @@ -1183,10 +1184,15 @@ | |
| 1184 | if (strchr(pMan->zUser, '@') == NULL) { |
| 1185 | zEmail = mprintf("%[email protected]", pMan->zUser); |
| 1186 | } else { |
| 1187 | zEmail = fossil_strdup(pMan->zUser); |
| 1188 | } |
| 1189 | } else if ((zTmp = strchr(zEmail, '<')) != NULL) { |
| 1190 | ++zTmp; |
| 1191 | char *zTmpEnd = strchr(zTmp, '>'); |
| 1192 | *(zTmpEnd) = '\0'; |
| 1193 | zEmail = fossil_strdup(zTmp); |
| 1194 | } |
| 1195 | fprintf(xCmd, "committer %s <%s> %s +0000\n", pMan->zUser, zEmail, buf); |
| 1196 | fossil_free(zEmail); |
| 1197 | blob_init(&comment, pMan->zComment, -1); |
| 1198 | if( blob_size(&comment)==0 ){ |
| 1199 |