Fossil SCM

Fix the tarball and ZIP archive generators so that the use the display hash to populate the manifest.uuid file.

drh 2017-02-28 19:47 fossil-2.0
Commit 9a8986b791ca171edc1fb3275857700c31448247
2 files changed +3 -6 +2 -5
+3 -6
--- src/tar.c
+++ src/tar.c
@@ -476,18 +476,19 @@
476476
Manifest *pManifest;
477477
ManifestFile *pFile;
478478
Blob filename;
479479
int nPrefix;
480480
char *zName = 0;
481
+ char *zUuid;
481482
unsigned int mTime;
482483
483484
content_get(rid, &mfile);
484485
if( blob_size(&mfile)==0 ){
485486
blob_zero(pTar);
486487
return;
487488
}
488
- blob_zero(&hash);
489
+ blob_set_dynamic(&hash, rid_to_uuid(rid));
489490
blob_zero(&filename);
490491
491492
if( zDir && zDir[0] ){
492493
blob_appendf(&filename, "%s/", zDir);
493494
}
@@ -520,13 +521,10 @@
520521
if( eflg & (MFESTFLG_RAW|MFESTFLG_UUID) ){
521522
if( eflg & MFESTFLG_RAW ){
522523
blob_append(&filename, "manifest", -1);
523524
zName = blob_str(&filename);
524525
}
525
- if( eflg & MFESTFLG_UUID ){
526
- sha1sum_blob(&mfile, &hash);
527
- }
528526
if( eflg & MFESTFLG_RAW ) {
529527
sterilize_manifest(&mfile);
530528
tar_add_file(zName, &mfile, 0, mTime);
531529
}
532530
}
@@ -535,11 +533,10 @@
535533
blob_append(&hash, "\n", 1);
536534
blob_resize(&filename, nPrefix);
537535
blob_append(&filename, "manifest.uuid", -1);
538536
zName = blob_str(&filename);
539537
tar_add_file(zName, &hash, 0, mTime);
540
- blob_reset(&hash);
541538
}
542539
if( eflg & MFESTFLG_TAGS ){
543540
Blob tagslist;
544541
blob_zero(&tagslist);
545542
get_checkin_taglist(rid, &tagslist);
@@ -564,19 +561,19 @@
564561
tar_add_file(zName, &file, manifest_file_mperm(pFile), mTime);
565562
blob_reset(&file);
566563
}
567564
}
568565
}else{
569
- sha1sum_blob(&mfile, &hash);
570566
blob_append(&filename, blob_str(&hash), 16);
571567
zName = blob_str(&filename);
572568
mTime = db_int64(0, "SELECT (julianday('now') - 2440587.5)*86400.0;");
573569
tar_begin(mTime);
574570
tar_add_file(zName, &mfile, 0, mTime);
575571
}
576572
manifest_destroy(pManifest);
577573
blob_reset(&mfile);
574
+ blob_reset(&hash);
578575
blob_reset(&filename);
579576
tar_finish(pTar);
580577
}
581578
582579
/*
583580
--- 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 @@
339339
content_get(rid, &mfile);
340340
if( blob_size(&mfile)==0 ){
341341
blob_zero(pZip);
342342
return;
343343
}
344
- blob_zero(&hash);
344
+ blob_set_dynamic(&hash, rid_to_uuid(rid));
345345
blob_zero(&filename);
346346
zip_open();
347347
348348
if( zDir && zDir[0] ){
349349
blob_appendf(&filename, "%s/", zDir);
@@ -378,13 +378,10 @@
378378
if( eflg & MFESTFLG_RAW ){
379379
blob_append(&filename, "manifest", -1);
380380
zName = blob_str(&filename);
381381
zip_add_folders(zName);
382382
}
383
- if( eflg & MFESTFLG_UUID ){
384
- sha1sum_blob(&mfile, &hash);
385
- }
386383
if( eflg & MFESTFLG_RAW ){
387384
sterilize_manifest(&mfile);
388385
zip_add_file(zName, &mfile, 0);
389386
}
390387
}
@@ -394,11 +391,10 @@
394391
blob_resize(&filename, nPrefix);
395392
blob_append(&filename, "manifest.uuid", -1);
396393
zName = blob_str(&filename);
397394
zip_add_folders(zName);
398395
zip_add_file(zName, &hash, 0);
399
- blob_reset(&hash);
400396
}
401397
if( eflg & MFESTFLG_TAGS ){
402398
Blob tagslist;
403399
blob_zero(&tagslist);
404400
get_checkin_taglist(rid, &tagslist);
@@ -429,10 +425,11 @@
429425
}else{
430426
blob_reset(&mfile);
431427
}
432428
manifest_destroy(pManifest);
433429
blob_reset(&filename);
430
+ blob_reset(&hash);
434431
zip_close(pZip);
435432
}
436433
437434
/*
438435
** COMMAND: zip*
439436
--- 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

Keyboard Shortcuts

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