Fossil SCM
Improvements to the way that hash name aliases are detected in the content_put_ex() routine.
Commit
53a2824ec031547afe8e43174762f0d25b6ee67d
Parent
104c8d3409b11eb…
1 file changed
+7
-5
+7
-5
| --- src/content.c | ||
| +++ src/content.c | ||
| @@ -516,18 +516,20 @@ | ||
| 516 | 516 | assert( pBlob!=0 ); |
| 517 | 517 | assert( srcId==0 || zUuid!=0 ); |
| 518 | 518 | db_begin_transaction(); |
| 519 | 519 | if( zUuid==0 ){ |
| 520 | 520 | assert( nBlob==0 ); |
| 521 | + /* First check the auxiliary hash to see if there is already an artifact | |
| 522 | + ** that uses the auxiliary hash name */ | |
| 521 | 523 | hname_hash(pBlob, 1, &hash); |
| 522 | 524 | rid = fast_uuid_to_rid(blob_str(&hash)); |
| 523 | - blob_reset(&hash); | |
| 524 | - if( rid ){ | |
| 525 | - db_end_transaction(0); | |
| 526 | - return rid; | |
| 525 | + if( rid==0 ){ | |
| 526 | + /* No existing artifact with the auxiliary hash name. Therefore, use | |
| 527 | + ** the primary hash name. */ | |
| 528 | + blob_reset(&hash); | |
| 529 | + hname_hash(pBlob, 0, &hash); | |
| 527 | 530 | } |
| 528 | - hname_hash(pBlob, 0, &hash); | |
| 529 | 531 | }else{ |
| 530 | 532 | blob_init(&hash, zUuid, -1); |
| 531 | 533 | } |
| 532 | 534 | if( nBlob ){ |
| 533 | 535 | size = nBlob; |
| 534 | 536 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -516,18 +516,20 @@ | |
| 516 | assert( pBlob!=0 ); |
| 517 | assert( srcId==0 || zUuid!=0 ); |
| 518 | db_begin_transaction(); |
| 519 | if( zUuid==0 ){ |
| 520 | assert( nBlob==0 ); |
| 521 | hname_hash(pBlob, 1, &hash); |
| 522 | rid = fast_uuid_to_rid(blob_str(&hash)); |
| 523 | blob_reset(&hash); |
| 524 | if( rid ){ |
| 525 | db_end_transaction(0); |
| 526 | return rid; |
| 527 | } |
| 528 | hname_hash(pBlob, 0, &hash); |
| 529 | }else{ |
| 530 | blob_init(&hash, zUuid, -1); |
| 531 | } |
| 532 | if( nBlob ){ |
| 533 | size = nBlob; |
| 534 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -516,18 +516,20 @@ | |
| 516 | assert( pBlob!=0 ); |
| 517 | assert( srcId==0 || zUuid!=0 ); |
| 518 | db_begin_transaction(); |
| 519 | if( zUuid==0 ){ |
| 520 | assert( nBlob==0 ); |
| 521 | /* First check the auxiliary hash to see if there is already an artifact |
| 522 | ** that uses the auxiliary hash name */ |
| 523 | hname_hash(pBlob, 1, &hash); |
| 524 | rid = fast_uuid_to_rid(blob_str(&hash)); |
| 525 | if( rid==0 ){ |
| 526 | /* No existing artifact with the auxiliary hash name. Therefore, use |
| 527 | ** the primary hash name. */ |
| 528 | blob_reset(&hash); |
| 529 | hname_hash(pBlob, 0, &hash); |
| 530 | } |
| 531 | }else{ |
| 532 | blob_init(&hash, zUuid, -1); |
| 533 | } |
| 534 | if( nBlob ){ |
| 535 | size = nBlob; |
| 536 |