Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | If the "fossil import --git" command encounters a file that looks like a well-formed Fossil artifact, append a line to the end of that file so that it is no longer a well-formed artifact before importing it. This prevents "manifest" files that found their way into Git from being reinterpreted by Fossil when the repository is reimported back into Fossil. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
2777682b632030db27990aa8b1f7ede6 |
User & Date: | drh 2020-09-11 15:40:49.197 |
Context
2020-09-11
| ||
16:41 | The <verbatim type="pikchr"> markup of Fossil wiki now always puts the resulting image in a separate block, not allowing it to be in-line. ... (check-in: a0ef47e7 user: drh tags: trunk) | |
15:40 | If the "fossil import --git" command encounters a file that looks like a well-formed Fossil artifact, append a line to the end of that file so that it is no longer a well-formed artifact before importing it. This prevents "manifest" files that found their way into Git from being reinterpreted by Fossil when the repository is reimported back into Fossil. ... (check-in: 2777682b user: drh tags: trunk) | |
15:20 | Enhancements to the test-parse-manifest command to also test the manifest_is_well_formed() interface. ... (check-in: 76169644 user: drh tags: trunk) | |
Changes
Changes to src/checkout.c.
︙ | ︙ | |||
178 179 180 181 182 183 184 | int flg; flg = db_get_manifest_setting(); if( flg & MFESTFLG_RAW ){ blob_zero(&manifest); content_get(vid, &manifest); | | | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | int flg; flg = db_get_manifest_setting(); if( flg & MFESTFLG_RAW ){ blob_zero(&manifest); content_get(vid, &manifest); sterilize_manifest(&manifest, CFTYPE_MANIFEST); zManFile = mprintf("%smanifest", g.zLocalRoot); blob_write_to_file(&manifest, zManFile); free(zManFile); }else{ if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest'") ){ zManFile = mprintf("%smanifest", g.zLocalRoot); file_delete(zManFile); |
︙ | ︙ |
Changes to src/import.c.
︙ | ︙ | |||
200 201 202 203 204 205 206 207 208 209 210 211 212 213 | /* ** Use data accumulated in gg from a "blob" record to add a new file ** to the BLOB table. */ static void finish_blob(void){ Blob content; blob_init(&content, gg.aData, gg.nData); fast_insert_content(&content, gg.zMark, 0, 0); blob_reset(&content); import_reset(0); } /* ** Use data accumulated in gg from a "tag" record to add a new | > > > | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | /* ** Use data accumulated in gg from a "blob" record to add a new file ** to the BLOB table. */ static void finish_blob(void){ Blob content; blob_init(&content, gg.aData, gg.nData); if( manifest_is_well_formed(gg.aData, gg.nData) ){ sterilize_manifest(&content, -1); } fast_insert_content(&content, gg.zMark, 0, 0); blob_reset(&content); import_reset(0); } /* ** Use data accumulated in gg from a "tag" record to add a new |
︙ | ︙ |
Changes to src/manifest.c.
︙ | ︙ | |||
2136 2137 2138 2139 2140 2141 2142 | ** the project are imported into a different Fossil project, the manifest ** file will not be interpreted as a control artifact in that other project. ** ** Normally it is sufficient to simply append the extra line of text. ** However, if the manifest is PGP signed then the extra line has to be ** inserted before the PGP signature (thus invalidating the signature). */ | | | > | | | 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 | ** the project are imported into a different Fossil project, the manifest ** file will not be interpreted as a control artifact in that other project. ** ** Normally it is sufficient to simply append the extra line of text. ** However, if the manifest is PGP signed then the extra line has to be ** inserted before the PGP signature (thus invalidating the signature). */ void sterilize_manifest(Blob *p, int eType){ char *z, *zOrig; int n, nOrig; static const char zExtraLine[] = "# Remove this line to create a well-formed Fossil %s.\n"; const char *zType = eType==CFTYPE_MANIFEST ? "manifest" : "control artifact"; z = zOrig = blob_materialize(p); n = nOrig = blob_size(p); remove_pgp_signature((const char **)&z, &n); if( z==zOrig ){ blob_appendf(p, zExtraLine/*works-like:"%s"*/, zType); }else{ int iEnd; Blob copy; memcpy(©, p, sizeof(copy)); blob_init(p, 0, 0); iEnd = (int)(&z[n] - zOrig); blob_append(p, zOrig, iEnd); blob_appendf(p, zExtraLine/*works-like:"%s"*/, zType); blob_append(p, &zOrig[iEnd], -1); blob_zero(©); } } /* ** This is the comparison function used to sort the tag array. |
︙ | ︙ |
Changes to src/tar.c.
︙ | ︙ | |||
525 526 527 528 529 530 531 | if( eflg & (MFESTFLG_RAW|MFESTFLG_UUID) ){ if( eflg & MFESTFLG_RAW ){ blob_append(&filename, "manifest", -1); zName = blob_str(&filename); } if( eflg & MFESTFLG_RAW ) { | | | 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | if( eflg & (MFESTFLG_RAW|MFESTFLG_UUID) ){ if( eflg & MFESTFLG_RAW ){ blob_append(&filename, "manifest", -1); zName = blob_str(&filename); } if( eflg & MFESTFLG_RAW ) { sterilize_manifest(&mfile, CFTYPE_MANIFEST); tar_add_file(zName, &mfile, 0, mTime); } } blob_reset(&mfile); if( eflg & MFESTFLG_UUID ){ blob_append(&hash, "\n", 1); blob_resize(&filename, nPrefix); |
︙ | ︙ |
Changes to src/zip.c.
︙ | ︙ | |||
677 678 679 680 681 682 683 | eflg |= MFESTFLG_TAGS; } if( eflg & MFESTFLG_RAW ){ blob_append(&filename, "manifest", -1); zName = blob_str(&filename); zip_add_folders(&sArchive, zName); | | | 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 | eflg |= MFESTFLG_TAGS; } if( eflg & MFESTFLG_RAW ){ blob_append(&filename, "manifest", -1); zName = blob_str(&filename); zip_add_folders(&sArchive, zName); sterilize_manifest(&mfile, CFTYPE_MANIFEST); zip_add_file(&sArchive, zName, &mfile, 0); } if( eflg & MFESTFLG_UUID ){ blob_append(&hash, "\n", 1); blob_resize(&filename, nPrefix); blob_append(&filename, "manifest.uuid", -1); zName = blob_str(&filename); |
︙ | ︙ |