Fossil SCM
Update the (undocumented) test-filezip command so that the ZIP archvie it creates has correct timestamps.
Commit
6368fce2745038d3709f004afaa50fe6c49d45173cf3262cf03d6214eae356d9
Parent
d3896c2acd8fe71…
1 file changed
+9
-3
+9
-3
| --- src/zip.c | ||
| +++ src/zip.c | ||
| @@ -577,20 +577,26 @@ | ||
| 577 | 577 | int eFType = SymFILE; |
| 578 | 578 | Archive sArchive; |
| 579 | 579 | memset(&sArchive, 0, sizeof(Archive)); |
| 580 | 580 | sArchive.eType = ARCHIVE_ZIP; |
| 581 | 581 | sArchive.pBlob = &zip; |
| 582 | - if( g.argc<3 ){ | |
| 583 | - usage("ARCHIVE FILE...."); | |
| 584 | - } | |
| 585 | 582 | if( find_option("dereference","h",0)!=0 ){ |
| 586 | 583 | eFType = ExtFILE; |
| 587 | 584 | } |
| 585 | + if( g.argc<3 ){ | |
| 586 | + usage("ARCHIVE FILE...."); | |
| 587 | + } | |
| 588 | + sqlite3_open(":memory:", &g.db); | |
| 588 | 589 | zip_open(); |
| 589 | 590 | for(i=3; i<g.argc; i++){ |
| 591 | + double rDate; | |
| 592 | + i64 iDate; | |
| 590 | 593 | blob_zero(&file); |
| 591 | 594 | blob_read_from_file(&file, g.argv[i], eFType); |
| 595 | + iDate = file_mtime(g.argv[i], eFType); | |
| 596 | + rDate = ((double)iDate)/86400.0 + 2440587.5; | |
| 597 | + zip_set_timedate(rDate); | |
| 592 | 598 | zip_add_file(&sArchive, g.argv[i], &file, file_perm(0,eFType)); |
| 593 | 599 | blob_reset(&file); |
| 594 | 600 | } |
| 595 | 601 | zip_close(&sArchive); |
| 596 | 602 | blob_write_to_file(&zip, g.argv[2]); |
| 597 | 603 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -577,20 +577,26 @@ | |
| 577 | int eFType = SymFILE; |
| 578 | Archive sArchive; |
| 579 | memset(&sArchive, 0, sizeof(Archive)); |
| 580 | sArchive.eType = ARCHIVE_ZIP; |
| 581 | sArchive.pBlob = &zip; |
| 582 | if( g.argc<3 ){ |
| 583 | usage("ARCHIVE FILE...."); |
| 584 | } |
| 585 | if( find_option("dereference","h",0)!=0 ){ |
| 586 | eFType = ExtFILE; |
| 587 | } |
| 588 | zip_open(); |
| 589 | for(i=3; i<g.argc; i++){ |
| 590 | blob_zero(&file); |
| 591 | blob_read_from_file(&file, g.argv[i], eFType); |
| 592 | zip_add_file(&sArchive, g.argv[i], &file, file_perm(0,eFType)); |
| 593 | blob_reset(&file); |
| 594 | } |
| 595 | zip_close(&sArchive); |
| 596 | blob_write_to_file(&zip, g.argv[2]); |
| 597 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -577,20 +577,26 @@ | |
| 577 | int eFType = SymFILE; |
| 578 | Archive sArchive; |
| 579 | memset(&sArchive, 0, sizeof(Archive)); |
| 580 | sArchive.eType = ARCHIVE_ZIP; |
| 581 | sArchive.pBlob = &zip; |
| 582 | if( find_option("dereference","h",0)!=0 ){ |
| 583 | eFType = ExtFILE; |
| 584 | } |
| 585 | if( g.argc<3 ){ |
| 586 | usage("ARCHIVE FILE...."); |
| 587 | } |
| 588 | sqlite3_open(":memory:", &g.db); |
| 589 | zip_open(); |
| 590 | for(i=3; i<g.argc; i++){ |
| 591 | double rDate; |
| 592 | i64 iDate; |
| 593 | blob_zero(&file); |
| 594 | blob_read_from_file(&file, g.argv[i], eFType); |
| 595 | iDate = file_mtime(g.argv[i], eFType); |
| 596 | rDate = ((double)iDate)/86400.0 + 2440587.5; |
| 597 | zip_set_timedate(rDate); |
| 598 | zip_add_file(&sArchive, g.argv[i], &file, file_perm(0,eFType)); |
| 599 | blob_reset(&file); |
| 600 | } |
| 601 | zip_close(&sArchive); |
| 602 | blob_write_to_file(&zip, g.argv[2]); |
| 603 |