Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix user's email being swapped with name in git export committer record. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
76d9a4555b56405d7d98b2e34fc12389 |
User & Date: | ashepilko 2017-01-06 04:09:22.293 |
Context
2017-01-06
| ||
13:09 | The "fossil all ui" command still does not work for repos that do not end in ".fossil", but it at least does not hyperlink them any more. ... (check-in: 805122df user: drh tags: trunk) | |
04:09 | Fix user's email being swapped with name in git export committer record. ... (check-in: 76d9a455 user: ashepilko tags: trunk) | |
2017-01-04
| ||
10:42 | Restore executable flags, accidently changed in previous commit ... (check-in: 5972c331 user: jan.nijtmans tags: trunk) | |
Changes
Changes to src/export.c.
︙ | ︙ | |||
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | int rid; char uuid[41]; }; #endif /* ** Output a "committer" record for the given user. */ static void print_person(const char *zUser){ static Stmt q; const char *zContact; char *zName; char *zEmail; int i, j; if( zUser==0 ){ printf(" <unknown>"); return; } db_static_prepare(&q, "SELECT info FROM user WHERE login=:user"); db_bind_text(&q, ":user", zUser); if( db_step(&q)!=SQLITE_ROW ){ db_reset(&q); | > > > > | | > > > | > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | < < < < < < < < < < < > | > > > > > | | | | > | > | | < < | < > > | | | | > > > > > | > > > > > | | > > | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | int rid; char uuid[41]; }; #endif /* ** Output a "committer" record for the given user. ** NOTE: the given user name may be an email itself. */ static void print_person(const char *zUser){ static Stmt q; const char *zContact; char *zName; char *zEmail; int i, j; int isBracketed, atEmailFirst, atEmailLast; if( zUser==0 ){ printf(" <unknown>"); return; } db_static_prepare(&q, "SELECT info FROM user WHERE login=:user"); db_bind_text(&q, ":user", zUser); if( db_step(&q)!=SQLITE_ROW ){ db_reset(&q); zName = mprintf("%s", zUser); for(i=j=0; zName[i]; i++){ if( zName[i]!='<' && zName[i]!='>' && zName[i]!='"' ){ zName[j++] = zName[i]; } } zName[j] = 0; printf(" %s <%s>", zName, zName); free(zName); return; } /* ** We have contact information. ** It may or may not contain an email address. ** ** ASSUME: ** - General case:"Name Unicoded" <email@address.com> other info ** - If contact information contains more than an email address, ** then the email address is enclosed between <> ** - When only email address is specified, then it's stored verbatim ** - When name part is absent or all-blanks, use zUser instead */ zName = NULL; zEmail = NULL; zContact = db_column_text(&q, 0); atEmailFirst = -1; atEmailLast = -1; isBracketed = 0; for(i=0; zContact[i] && zContact[i]!='@'; i++){ if( zContact[i]=='<' ){ isBracketed = 1; atEmailFirst = i+1; } else if( zContact[i]=='>' ){ isBracketed = 0; atEmailFirst = i+1; } else if( zContact[i]==' ' && !isBracketed ){ atEmailFirst = i+1; } } if( zContact[i]==0 ){ /* No email address found. Take as user info if not empty */ zName = mprintf("%s", zContact[0] ? zContact : zUser); for(i=j=0; zName[i]; i++){ if( zName[i]!='<' && zName[i]!='>' && zName[i]!='"' ){ zName[j++] = zName[i]; } } zName[j] = 0; printf(" %s <%s>", zName, zName); free(zName); db_reset(&q); return; } for(j=i+1; zContact[j] && zContact[j]!=' '; j++){ if( zContact[j]=='>' ) atEmailLast = j-1; } if ( atEmailLast==-1 ) atEmailLast = j-1; if ( atEmailFirst==-1 ) atEmailFirst = 0; /* Found only email */ /* ** Found beginning and end of email address. ** Extract the address (trimmed and sanitized). */ for(j=atEmailFirst; zContact[j] && zContact[j]==' '; j++){} zEmail = mprintf("%.*s", atEmailLast-j+1, &zContact[j]); for(i=j=0; zEmail[i]; i++){ if( zEmail[i]!='<' && zEmail[i]!='>' ){ zEmail[j++] = zEmail[i]; } } zEmail[j] = 0; /* ** When bracketed email, extract the string _before_ ** email as user name (may be enquoted). ** If missing or all-blank name, use zUser. */ if( isBracketed && (atEmailFirst-1) > 0){ for(i=atEmailFirst-2; i>=0 && zContact[i] && zContact[i]==' '; i--){} if( i>=0 ){ for(j=0; j<i && zContact[j] && zContact[j]==' '; j++){} zName = mprintf("%.*s", i-j+1, &zContact[j]); } } if( zName==NULL ) zName = mprintf("%s", zUser); for(i=j=0; zName[i]; i++){ if( zName[i]!='<' && zName[i]!='>' && zName[i]!='"' ){ zName[j++] = zName[i]; } } zName[j] = 0; printf(" %s <%s>", zName, zEmail); free(zName); free(zEmail); db_reset(&q); } #define BLOBMARK(rid) ((rid) * 2) #define COMMITMARK(rid) ((rid) * 2 + 1) |
︙ | ︙ |