Fossil SCM
Fix recognition of sha3 in marks file. Patch adapted from Dingyuan Wang's report. Thanks!
Commit
90b07ed5880a844444f23f480ea185ef11ab38831470f1b80309b34d20de8566
Parent
37cbd97cab783a3…
1 file changed
+5
-5
+5
-5
| --- src/export.c | ||
| +++ src/export.c | ||
| @@ -35,16 +35,16 @@ | ||
| 35 | 35 | ** and fossil commits. |
| 36 | 36 | ** -git_name: This is the mark name that identifies the commit to git. |
| 37 | 37 | ** It will always begin with a ':'. |
| 38 | 38 | ** -rid: The unique object ID that identifies this commit within the |
| 39 | 39 | ** repository database. |
| 40 | -** -uuid: The SHA-1 of artifact corresponding to rid. | |
| 40 | +** -uuid: The SHA-1/SHA3 of artifact corresponding to rid. | |
| 41 | 41 | */ |
| 42 | 42 | struct mark_t{ |
| 43 | 43 | char *name; |
| 44 | 44 | int rid; |
| 45 | - char uuid[41]; | |
| 45 | + char uuid[65]; | |
| 46 | 46 | }; |
| 47 | 47 | #endif |
| 48 | 48 | |
| 49 | 49 | /* |
| 50 | 50 | ** Output a "committer" record for the given user. |
| @@ -340,22 +340,22 @@ | ||
| 340 | 340 | }else{ |
| 341 | 341 | mark->name = fossil_strdup(cur_tok); |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | cur_tok = strtok(NULL, "\n"); |
| 345 | - if( !cur_tok || strlen(cur_tok)!=40 ){ | |
| 345 | + if( !cur_tok || (strlen(cur_tok)!=40 && strlen(cur_tok)!=64) ){ | |
| 346 | 346 | free(mark->name); |
| 347 | - fossil_trace("Invalid SHA-1 in marks file: %s\n", cur_tok); | |
| 347 | + fossil_trace("Invalid SHA-1/SHA-3 in marks file: %s\n", cur_tok); | |
| 348 | 348 | return -1; |
| 349 | 349 | }else{ |
| 350 | 350 | sqlite3_snprintf(sizeof(mark->uuid), mark->uuid, "%s", cur_tok); |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | /* make sure that rid corresponds to UUID */ |
| 354 | 354 | if( fast_uuid_to_rid(mark->uuid)!=mark->rid ){ |
| 355 | 355 | free(mark->name); |
| 356 | - fossil_trace("Non-existent SHA-1 in marks file: %s\n", mark->uuid); | |
| 356 | + fossil_trace("Non-existent SHA-1/SHA3 in marks file: %s\n", mark->uuid); | |
| 357 | 357 | return -1; |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | /* insert a cross-ref into the 'xmark' table */ |
| 361 | 361 | insert_commit_xref(mark->rid, mark->name, mark->uuid); |
| 362 | 362 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -35,16 +35,16 @@ | |
| 35 | ** and fossil commits. |
| 36 | ** -git_name: This is the mark name that identifies the commit to git. |
| 37 | ** It will always begin with a ':'. |
| 38 | ** -rid: The unique object ID that identifies this commit within the |
| 39 | ** repository database. |
| 40 | ** -uuid: The SHA-1 of artifact corresponding to rid. |
| 41 | */ |
| 42 | struct mark_t{ |
| 43 | char *name; |
| 44 | int rid; |
| 45 | char uuid[41]; |
| 46 | }; |
| 47 | #endif |
| 48 | |
| 49 | /* |
| 50 | ** Output a "committer" record for the given user. |
| @@ -340,22 +340,22 @@ | |
| 340 | }else{ |
| 341 | mark->name = fossil_strdup(cur_tok); |
| 342 | } |
| 343 | |
| 344 | cur_tok = strtok(NULL, "\n"); |
| 345 | if( !cur_tok || strlen(cur_tok)!=40 ){ |
| 346 | free(mark->name); |
| 347 | fossil_trace("Invalid SHA-1 in marks file: %s\n", cur_tok); |
| 348 | return -1; |
| 349 | }else{ |
| 350 | sqlite3_snprintf(sizeof(mark->uuid), mark->uuid, "%s", cur_tok); |
| 351 | } |
| 352 | |
| 353 | /* make sure that rid corresponds to UUID */ |
| 354 | if( fast_uuid_to_rid(mark->uuid)!=mark->rid ){ |
| 355 | free(mark->name); |
| 356 | fossil_trace("Non-existent SHA-1 in marks file: %s\n", mark->uuid); |
| 357 | return -1; |
| 358 | } |
| 359 | |
| 360 | /* insert a cross-ref into the 'xmark' table */ |
| 361 | insert_commit_xref(mark->rid, mark->name, mark->uuid); |
| 362 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -35,16 +35,16 @@ | |
| 35 | ** and fossil commits. |
| 36 | ** -git_name: This is the mark name that identifies the commit to git. |
| 37 | ** It will always begin with a ':'. |
| 38 | ** -rid: The unique object ID that identifies this commit within the |
| 39 | ** repository database. |
| 40 | ** -uuid: The SHA-1/SHA3 of artifact corresponding to rid. |
| 41 | */ |
| 42 | struct mark_t{ |
| 43 | char *name; |
| 44 | int rid; |
| 45 | char uuid[65]; |
| 46 | }; |
| 47 | #endif |
| 48 | |
| 49 | /* |
| 50 | ** Output a "committer" record for the given user. |
| @@ -340,22 +340,22 @@ | |
| 340 | }else{ |
| 341 | mark->name = fossil_strdup(cur_tok); |
| 342 | } |
| 343 | |
| 344 | cur_tok = strtok(NULL, "\n"); |
| 345 | if( !cur_tok || (strlen(cur_tok)!=40 && strlen(cur_tok)!=64) ){ |
| 346 | free(mark->name); |
| 347 | fossil_trace("Invalid SHA-1/SHA-3 in marks file: %s\n", cur_tok); |
| 348 | return -1; |
| 349 | }else{ |
| 350 | sqlite3_snprintf(sizeof(mark->uuid), mark->uuid, "%s", cur_tok); |
| 351 | } |
| 352 | |
| 353 | /* make sure that rid corresponds to UUID */ |
| 354 | if( fast_uuid_to_rid(mark->uuid)!=mark->rid ){ |
| 355 | free(mark->name); |
| 356 | fossil_trace("Non-existent SHA-1/SHA3 in marks file: %s\n", mark->uuid); |
| 357 | return -1; |
| 358 | } |
| 359 | |
| 360 | /* insert a cross-ref into the 'xmark' table */ |
| 361 | insert_commit_xref(mark->rid, mark->name, mark->uuid); |
| 362 |