Fossil

Check-in [9360b66a]
Login

Check-in [9360b66a]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix incorrect parsing of RFC 822 user contact info when exporting to a Git repository as reported by Warren in forum post 29e358909c.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9360b66a67086d6421383326904ab470ba4f5a9593124b5b96a956202e3c378b
User & Date: jamsek 2020-11-19 13:34:31
References
2021-01-06
15:38
Fix multiple problems with check-in [9360b66a67086d64] that can lead to crashes in Fossil itself, and in git-fast-import, when attempting to mirror the Fossil self-hosting repository to Git. ... (check-in: b001a1c3 user: drh tags: trunk)
Context
2020-11-20
00:53
Fix a typo in the hashpolicy.wiki document. ... (check-in: 3b363b30 user: drh tags: trunk)
2020-11-19
13:34
Fix incorrect parsing of RFC 822 user contact info when exporting to a Git repository as reported by Warren in forum post 29e358909c. ... (check-in: 9360b66a user: jamsek tags: trunk)
2020-11-18
14:47
Improved error messages from the forum when the forum artifact ID is incorrect. ... (check-in: 93a5d659 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/export.c.

1168
1169
1170
1171
1172
1173
1174

1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187





1188
1189
1190
1191
1192
1193
1194
     (sqlite3_int64)((pMan->rDate-2440587.5)*86400.0)
  );
  /*
  ** Check for 'fx_' table from previous Git import, otherwise take contact info
  ** from user table for <emailaddr> in committer field. If no emailaddr, check
  ** if username is in email form, otherwise use generic 'username@noemail.net'.
  */

  if (db_table_exists("repository", "fx_git")) {
    zEmail = db_text(0, "SELECT email FROM fx_git WHERE user=%Q", pMan->zUser);
  } else {
    zEmail = db_text(0, "SELECT info FROM user WHERE login=%Q", pMan->zUser);
  }
  /* Some repo 'info' fields return an empty string hence the second check */
  if (zEmail == NULL || zEmail[0] == '\0') {
    /* If username is in emailaddr form, don't append '@noemail.net' */
    if (strchr(pMan->zUser, '@') == NULL) {
      zEmail = mprintf("%s@noemail.net", pMan->zUser);
    } else {
      zEmail = fossil_strdup(pMan->zUser);
    }





  }
  fprintf(xCmd, "committer %s <%s> %s +0000\n", pMan->zUser, zEmail, buf);
  fossil_free(zEmail);
  blob_init(&comment, pMan->zComment, -1);
  if( blob_size(&comment)==0 ){
    blob_append(&comment, "(no comment)", -1);
  }







>













>
>
>
>
>







1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
     (sqlite3_int64)((pMan->rDate-2440587.5)*86400.0)
  );
  /*
  ** Check for 'fx_' table from previous Git import, otherwise take contact info
  ** from user table for <emailaddr> in committer field. If no emailaddr, check
  ** if username is in email form, otherwise use generic 'username@noemail.net'.
  */
  char *zTmp;
  if (db_table_exists("repository", "fx_git")) {
    zEmail = db_text(0, "SELECT email FROM fx_git WHERE user=%Q", pMan->zUser);
  } else {
    zEmail = db_text(0, "SELECT info FROM user WHERE login=%Q", pMan->zUser);
  }
  /* Some repo 'info' fields return an empty string hence the second check */
  if (zEmail == NULL || zEmail[0] == '\0') {
    /* If username is in emailaddr form, don't append '@noemail.net' */
    if (strchr(pMan->zUser, '@') == NULL) {
      zEmail = mprintf("%s@noemail.net", pMan->zUser);
    } else {
      zEmail = fossil_strdup(pMan->zUser);
    }
  } else if ((zTmp = strchr(zEmail, '<')) != NULL) {
    ++zTmp;
    char *zTmpEnd = strchr(zTmp, '>');
    *(zTmpEnd) = '\0';
    zEmail = fossil_strdup(zTmp);
  }
  fprintf(xCmd, "committer %s <%s> %s +0000\n", pMan->zUser, zEmail, buf);
  fossil_free(zEmail);
  blob_init(&comment, pMan->zComment, -1);
  if( blob_size(&comment)==0 ){
    blob_append(&comment, "(no comment)", -1);
  }