Fossil SCM
Fix the tarball and ZIP archive generators so that the use the display hash to populate the manifest.uuid file.
Commit
9a8986b791ca171edc1fb3275857700c31448247
Parent
08badee3a415cf0…
2 files changed
+3
-6
+2
-5
+3
-6
| --- src/tar.c | ||
| +++ src/tar.c | ||
| @@ -476,18 +476,19 @@ | ||
| 476 | 476 | Manifest *pManifest; |
| 477 | 477 | ManifestFile *pFile; |
| 478 | 478 | Blob filename; |
| 479 | 479 | int nPrefix; |
| 480 | 480 | char *zName = 0; |
| 481 | + char *zUuid; | |
| 481 | 482 | unsigned int mTime; |
| 482 | 483 | |
| 483 | 484 | content_get(rid, &mfile); |
| 484 | 485 | if( blob_size(&mfile)==0 ){ |
| 485 | 486 | blob_zero(pTar); |
| 486 | 487 | return; |
| 487 | 488 | } |
| 488 | - blob_zero(&hash); | |
| 489 | + blob_set_dynamic(&hash, rid_to_uuid(rid)); | |
| 489 | 490 | blob_zero(&filename); |
| 490 | 491 | |
| 491 | 492 | if( zDir && zDir[0] ){ |
| 492 | 493 | blob_appendf(&filename, "%s/", zDir); |
| 493 | 494 | } |
| @@ -520,13 +521,10 @@ | ||
| 520 | 521 | if( eflg & (MFESTFLG_RAW|MFESTFLG_UUID) ){ |
| 521 | 522 | if( eflg & MFESTFLG_RAW ){ |
| 522 | 523 | blob_append(&filename, "manifest", -1); |
| 523 | 524 | zName = blob_str(&filename); |
| 524 | 525 | } |
| 525 | - if( eflg & MFESTFLG_UUID ){ | |
| 526 | - sha1sum_blob(&mfile, &hash); | |
| 527 | - } | |
| 528 | 526 | if( eflg & MFESTFLG_RAW ) { |
| 529 | 527 | sterilize_manifest(&mfile); |
| 530 | 528 | tar_add_file(zName, &mfile, 0, mTime); |
| 531 | 529 | } |
| 532 | 530 | } |
| @@ -535,11 +533,10 @@ | ||
| 535 | 533 | blob_append(&hash, "\n", 1); |
| 536 | 534 | blob_resize(&filename, nPrefix); |
| 537 | 535 | blob_append(&filename, "manifest.uuid", -1); |
| 538 | 536 | zName = blob_str(&filename); |
| 539 | 537 | tar_add_file(zName, &hash, 0, mTime); |
| 540 | - blob_reset(&hash); | |
| 541 | 538 | } |
| 542 | 539 | if( eflg & MFESTFLG_TAGS ){ |
| 543 | 540 | Blob tagslist; |
| 544 | 541 | blob_zero(&tagslist); |
| 545 | 542 | get_checkin_taglist(rid, &tagslist); |
| @@ -564,19 +561,19 @@ | ||
| 564 | 561 | tar_add_file(zName, &file, manifest_file_mperm(pFile), mTime); |
| 565 | 562 | blob_reset(&file); |
| 566 | 563 | } |
| 567 | 564 | } |
| 568 | 565 | }else{ |
| 569 | - sha1sum_blob(&mfile, &hash); | |
| 570 | 566 | blob_append(&filename, blob_str(&hash), 16); |
| 571 | 567 | zName = blob_str(&filename); |
| 572 | 568 | mTime = db_int64(0, "SELECT (julianday('now') - 2440587.5)*86400.0;"); |
| 573 | 569 | tar_begin(mTime); |
| 574 | 570 | tar_add_file(zName, &mfile, 0, mTime); |
| 575 | 571 | } |
| 576 | 572 | manifest_destroy(pManifest); |
| 577 | 573 | blob_reset(&mfile); |
| 574 | + blob_reset(&hash); | |
| 578 | 575 | blob_reset(&filename); |
| 579 | 576 | tar_finish(pTar); |
| 580 | 577 | } |
| 581 | 578 | |
| 582 | 579 | /* |
| 583 | 580 |
| --- src/tar.c | |
| +++ src/tar.c | |
| @@ -476,18 +476,19 @@ | |
| 476 | Manifest *pManifest; |
| 477 | ManifestFile *pFile; |
| 478 | Blob filename; |
| 479 | int nPrefix; |
| 480 | char *zName = 0; |
| 481 | unsigned int mTime; |
| 482 | |
| 483 | content_get(rid, &mfile); |
| 484 | if( blob_size(&mfile)==0 ){ |
| 485 | blob_zero(pTar); |
| 486 | return; |
| 487 | } |
| 488 | blob_zero(&hash); |
| 489 | blob_zero(&filename); |
| 490 | |
| 491 | if( zDir && zDir[0] ){ |
| 492 | blob_appendf(&filename, "%s/", zDir); |
| 493 | } |
| @@ -520,13 +521,10 @@ | |
| 520 | if( eflg & (MFESTFLG_RAW|MFESTFLG_UUID) ){ |
| 521 | if( eflg & MFESTFLG_RAW ){ |
| 522 | blob_append(&filename, "manifest", -1); |
| 523 | zName = blob_str(&filename); |
| 524 | } |
| 525 | if( eflg & MFESTFLG_UUID ){ |
| 526 | sha1sum_blob(&mfile, &hash); |
| 527 | } |
| 528 | if( eflg & MFESTFLG_RAW ) { |
| 529 | sterilize_manifest(&mfile); |
| 530 | tar_add_file(zName, &mfile, 0, mTime); |
| 531 | } |
| 532 | } |
| @@ -535,11 +533,10 @@ | |
| 535 | blob_append(&hash, "\n", 1); |
| 536 | blob_resize(&filename, nPrefix); |
| 537 | blob_append(&filename, "manifest.uuid", -1); |
| 538 | zName = blob_str(&filename); |
| 539 | tar_add_file(zName, &hash, 0, mTime); |
| 540 | blob_reset(&hash); |
| 541 | } |
| 542 | if( eflg & MFESTFLG_TAGS ){ |
| 543 | Blob tagslist; |
| 544 | blob_zero(&tagslist); |
| 545 | get_checkin_taglist(rid, &tagslist); |
| @@ -564,19 +561,19 @@ | |
| 564 | tar_add_file(zName, &file, manifest_file_mperm(pFile), mTime); |
| 565 | blob_reset(&file); |
| 566 | } |
| 567 | } |
| 568 | }else{ |
| 569 | sha1sum_blob(&mfile, &hash); |
| 570 | blob_append(&filename, blob_str(&hash), 16); |
| 571 | zName = blob_str(&filename); |
| 572 | mTime = db_int64(0, "SELECT (julianday('now') - 2440587.5)*86400.0;"); |
| 573 | tar_begin(mTime); |
| 574 | tar_add_file(zName, &mfile, 0, mTime); |
| 575 | } |
| 576 | manifest_destroy(pManifest); |
| 577 | blob_reset(&mfile); |
| 578 | blob_reset(&filename); |
| 579 | tar_finish(pTar); |
| 580 | } |
| 581 | |
| 582 | /* |
| 583 |
| --- src/tar.c | |
| +++ src/tar.c | |
| @@ -476,18 +476,19 @@ | |
| 476 | Manifest *pManifest; |
| 477 | ManifestFile *pFile; |
| 478 | Blob filename; |
| 479 | int nPrefix; |
| 480 | char *zName = 0; |
| 481 | char *zUuid; |
| 482 | unsigned int mTime; |
| 483 | |
| 484 | content_get(rid, &mfile); |
| 485 | if( blob_size(&mfile)==0 ){ |
| 486 | blob_zero(pTar); |
| 487 | return; |
| 488 | } |
| 489 | blob_set_dynamic(&hash, rid_to_uuid(rid)); |
| 490 | blob_zero(&filename); |
| 491 | |
| 492 | if( zDir && zDir[0] ){ |
| 493 | blob_appendf(&filename, "%s/", zDir); |
| 494 | } |
| @@ -520,13 +521,10 @@ | |
| 521 | if( eflg & (MFESTFLG_RAW|MFESTFLG_UUID) ){ |
| 522 | if( eflg & MFESTFLG_RAW ){ |
| 523 | blob_append(&filename, "manifest", -1); |
| 524 | zName = blob_str(&filename); |
| 525 | } |
| 526 | if( eflg & MFESTFLG_RAW ) { |
| 527 | sterilize_manifest(&mfile); |
| 528 | tar_add_file(zName, &mfile, 0, mTime); |
| 529 | } |
| 530 | } |
| @@ -535,11 +533,10 @@ | |
| 533 | blob_append(&hash, "\n", 1); |
| 534 | blob_resize(&filename, nPrefix); |
| 535 | blob_append(&filename, "manifest.uuid", -1); |
| 536 | zName = blob_str(&filename); |
| 537 | tar_add_file(zName, &hash, 0, mTime); |
| 538 | } |
| 539 | if( eflg & MFESTFLG_TAGS ){ |
| 540 | Blob tagslist; |
| 541 | blob_zero(&tagslist); |
| 542 | get_checkin_taglist(rid, &tagslist); |
| @@ -564,19 +561,19 @@ | |
| 561 | tar_add_file(zName, &file, manifest_file_mperm(pFile), mTime); |
| 562 | blob_reset(&file); |
| 563 | } |
| 564 | } |
| 565 | }else{ |
| 566 | blob_append(&filename, blob_str(&hash), 16); |
| 567 | zName = blob_str(&filename); |
| 568 | mTime = db_int64(0, "SELECT (julianday('now') - 2440587.5)*86400.0;"); |
| 569 | tar_begin(mTime); |
| 570 | tar_add_file(zName, &mfile, 0, mTime); |
| 571 | } |
| 572 | manifest_destroy(pManifest); |
| 573 | blob_reset(&mfile); |
| 574 | blob_reset(&hash); |
| 575 | blob_reset(&filename); |
| 576 | tar_finish(pTar); |
| 577 | } |
| 578 | |
| 579 | /* |
| 580 |
+2
-5
| --- src/zip.c | ||
| +++ src/zip.c | ||
| @@ -339,11 +339,11 @@ | ||
| 339 | 339 | content_get(rid, &mfile); |
| 340 | 340 | if( blob_size(&mfile)==0 ){ |
| 341 | 341 | blob_zero(pZip); |
| 342 | 342 | return; |
| 343 | 343 | } |
| 344 | - blob_zero(&hash); | |
| 344 | + blob_set_dynamic(&hash, rid_to_uuid(rid)); | |
| 345 | 345 | blob_zero(&filename); |
| 346 | 346 | zip_open(); |
| 347 | 347 | |
| 348 | 348 | if( zDir && zDir[0] ){ |
| 349 | 349 | blob_appendf(&filename, "%s/", zDir); |
| @@ -378,13 +378,10 @@ | ||
| 378 | 378 | if( eflg & MFESTFLG_RAW ){ |
| 379 | 379 | blob_append(&filename, "manifest", -1); |
| 380 | 380 | zName = blob_str(&filename); |
| 381 | 381 | zip_add_folders(zName); |
| 382 | 382 | } |
| 383 | - if( eflg & MFESTFLG_UUID ){ | |
| 384 | - sha1sum_blob(&mfile, &hash); | |
| 385 | - } | |
| 386 | 383 | if( eflg & MFESTFLG_RAW ){ |
| 387 | 384 | sterilize_manifest(&mfile); |
| 388 | 385 | zip_add_file(zName, &mfile, 0); |
| 389 | 386 | } |
| 390 | 387 | } |
| @@ -394,11 +391,10 @@ | ||
| 394 | 391 | blob_resize(&filename, nPrefix); |
| 395 | 392 | blob_append(&filename, "manifest.uuid", -1); |
| 396 | 393 | zName = blob_str(&filename); |
| 397 | 394 | zip_add_folders(zName); |
| 398 | 395 | zip_add_file(zName, &hash, 0); |
| 399 | - blob_reset(&hash); | |
| 400 | 396 | } |
| 401 | 397 | if( eflg & MFESTFLG_TAGS ){ |
| 402 | 398 | Blob tagslist; |
| 403 | 399 | blob_zero(&tagslist); |
| 404 | 400 | get_checkin_taglist(rid, &tagslist); |
| @@ -429,10 +425,11 @@ | ||
| 429 | 425 | }else{ |
| 430 | 426 | blob_reset(&mfile); |
| 431 | 427 | } |
| 432 | 428 | manifest_destroy(pManifest); |
| 433 | 429 | blob_reset(&filename); |
| 430 | + blob_reset(&hash); | |
| 434 | 431 | zip_close(pZip); |
| 435 | 432 | } |
| 436 | 433 | |
| 437 | 434 | /* |
| 438 | 435 | ** COMMAND: zip* |
| 439 | 436 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -339,11 +339,11 @@ | |
| 339 | content_get(rid, &mfile); |
| 340 | if( blob_size(&mfile)==0 ){ |
| 341 | blob_zero(pZip); |
| 342 | return; |
| 343 | } |
| 344 | blob_zero(&hash); |
| 345 | blob_zero(&filename); |
| 346 | zip_open(); |
| 347 | |
| 348 | if( zDir && zDir[0] ){ |
| 349 | blob_appendf(&filename, "%s/", zDir); |
| @@ -378,13 +378,10 @@ | |
| 378 | if( eflg & MFESTFLG_RAW ){ |
| 379 | blob_append(&filename, "manifest", -1); |
| 380 | zName = blob_str(&filename); |
| 381 | zip_add_folders(zName); |
| 382 | } |
| 383 | if( eflg & MFESTFLG_UUID ){ |
| 384 | sha1sum_blob(&mfile, &hash); |
| 385 | } |
| 386 | if( eflg & MFESTFLG_RAW ){ |
| 387 | sterilize_manifest(&mfile); |
| 388 | zip_add_file(zName, &mfile, 0); |
| 389 | } |
| 390 | } |
| @@ -394,11 +391,10 @@ | |
| 394 | blob_resize(&filename, nPrefix); |
| 395 | blob_append(&filename, "manifest.uuid", -1); |
| 396 | zName = blob_str(&filename); |
| 397 | zip_add_folders(zName); |
| 398 | zip_add_file(zName, &hash, 0); |
| 399 | blob_reset(&hash); |
| 400 | } |
| 401 | if( eflg & MFESTFLG_TAGS ){ |
| 402 | Blob tagslist; |
| 403 | blob_zero(&tagslist); |
| 404 | get_checkin_taglist(rid, &tagslist); |
| @@ -429,10 +425,11 @@ | |
| 429 | }else{ |
| 430 | blob_reset(&mfile); |
| 431 | } |
| 432 | manifest_destroy(pManifest); |
| 433 | blob_reset(&filename); |
| 434 | zip_close(pZip); |
| 435 | } |
| 436 | |
| 437 | /* |
| 438 | ** COMMAND: zip* |
| 439 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -339,11 +339,11 @@ | |
| 339 | content_get(rid, &mfile); |
| 340 | if( blob_size(&mfile)==0 ){ |
| 341 | blob_zero(pZip); |
| 342 | return; |
| 343 | } |
| 344 | blob_set_dynamic(&hash, rid_to_uuid(rid)); |
| 345 | blob_zero(&filename); |
| 346 | zip_open(); |
| 347 | |
| 348 | if( zDir && zDir[0] ){ |
| 349 | blob_appendf(&filename, "%s/", zDir); |
| @@ -378,13 +378,10 @@ | |
| 378 | if( eflg & MFESTFLG_RAW ){ |
| 379 | blob_append(&filename, "manifest", -1); |
| 380 | zName = blob_str(&filename); |
| 381 | zip_add_folders(zName); |
| 382 | } |
| 383 | if( eflg & MFESTFLG_RAW ){ |
| 384 | sterilize_manifest(&mfile); |
| 385 | zip_add_file(zName, &mfile, 0); |
| 386 | } |
| 387 | } |
| @@ -394,11 +391,10 @@ | |
| 391 | blob_resize(&filename, nPrefix); |
| 392 | blob_append(&filename, "manifest.uuid", -1); |
| 393 | zName = blob_str(&filename); |
| 394 | zip_add_folders(zName); |
| 395 | zip_add_file(zName, &hash, 0); |
| 396 | } |
| 397 | if( eflg & MFESTFLG_TAGS ){ |
| 398 | Blob tagslist; |
| 399 | blob_zero(&tagslist); |
| 400 | get_checkin_taglist(rid, &tagslist); |
| @@ -429,10 +425,11 @@ | |
| 425 | }else{ |
| 426 | blob_reset(&mfile); |
| 427 | } |
| 428 | manifest_destroy(pManifest); |
| 429 | blob_reset(&filename); |
| 430 | blob_reset(&hash); |
| 431 | zip_close(pZip); |
| 432 | } |
| 433 | |
| 434 | /* |
| 435 | ** COMMAND: zip* |
| 436 |