Fossil SCM

Improvements to the way that hash name aliases are detected in the content_put_ex() routine.

drh 2017-03-01 14:55 fossil-2.0
Commit 53a2824ec031547afe8e43174762f0d25b6ee67d
1 file changed +7 -5
+7 -5
--- src/content.c
+++ src/content.c
@@ -516,18 +516,20 @@
516516
assert( pBlob!=0 );
517517
assert( srcId==0 || zUuid!=0 );
518518
db_begin_transaction();
519519
if( zUuid==0 ){
520520
assert( nBlob==0 );
521
+ /* First check the auxiliary hash to see if there is already an artifact
522
+ ** that uses the auxiliary hash name */
521523
hname_hash(pBlob, 1, &hash);
522524
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);
527530
}
528
- hname_hash(pBlob, 0, &hash);
529531
}else{
530532
blob_init(&hash, zUuid, -1);
531533
}
532534
if( nBlob ){
533535
size = nBlob;
534536
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button