Fossil SCM
Add manifest.tags to the list of potentially reserved names and decouple manifest and manifest.uuid from each other.
Commit
142cb7aabdc746a5cf82104325a16cb8e54e6ccc
Parent
226e7c28427e9d1…
1 file changed
+21
-8
+21
-8
| --- src/add.c | ||
| +++ src/add.c | ||
| @@ -71,29 +71,42 @@ | ||
| 71 | 71 | ".fos-journal", |
| 72 | 72 | ".fos-wal", |
| 73 | 73 | ".fos-shm", |
| 74 | 74 | }; |
| 75 | 75 | |
| 76 | - /* Names of auxiliary files generated by SQLite when the "manifest" | |
| 77 | - ** property is enabled | |
| 76 | + /* Possible names of auxiliary files generated when the "manifest" property | |
| 77 | + ** is used | |
| 78 | 78 | */ |
| 79 | - static const char *const azManifest[] = { | |
| 80 | - "manifest", | |
| 81 | - "manifest.uuid", | |
| 79 | + static const struct { | |
| 80 | + const char *fname; | |
| 81 | + int flg; | |
| 82 | + }aManifestflags[] = { | |
| 83 | + { "manifest", MFESTFLG_RAW }, | |
| 84 | + { "manifest.uuid", MFESTFLG_UUID }, | |
| 85 | + { "manifest.tags", MFESTFLG_TAGS } | |
| 82 | 86 | }; |
| 87 | + static const char *azManifests[3]; | |
| 83 | 88 | |
| 84 | 89 | /* |
| 85 | 90 | ** Names of repository files, if they exist in the checkout. |
| 86 | 91 | */ |
| 87 | 92 | static const char *azRepo[4] = { 0, 0, 0, 0 }; |
| 88 | 93 | |
| 89 | 94 | /* Cached setting "manifest" */ |
| 90 | 95 | static int cachedManifest = -1; |
| 96 | + static int numManifests; | |
| 91 | 97 | |
| 92 | 98 | if( cachedManifest == -1 ){ |
| 99 | + int i; | |
| 93 | 100 | Blob repo; |
| 94 | - cachedManifest = db_get_boolean("manifest",0); | |
| 101 | + cachedManifest = db_get_manifest_setting(); | |
| 102 | + numManifests = 0; | |
| 103 | + for(i=0; i<count(aManifestflags); i++){ | |
| 104 | + if( cachedManifest&aManifestflags[i].flg ) { | |
| 105 | + azManifests[numManifests++] = aManifestflags[i].fname; | |
| 106 | + } | |
| 107 | + } | |
| 95 | 108 | blob_zero(&repo); |
| 96 | 109 | if( file_tree_name(g.zRepositoryName, &repo, 0, 0) ){ |
| 97 | 110 | const char *zRepo = blob_str(&repo); |
| 98 | 111 | azRepo[0] = zRepo; |
| 99 | 112 | azRepo[1] = mprintf("%s-journal", zRepo); |
| @@ -104,12 +117,12 @@ | ||
| 104 | 117 | |
| 105 | 118 | if( N<0 ) return 0; |
| 106 | 119 | if( N<count(azName) ) return azName[N]; |
| 107 | 120 | N -= count(azName); |
| 108 | 121 | if( cachedManifest ){ |
| 109 | - if( N<count(azManifest) ) return azManifest[N]; | |
| 110 | - N -= count(azManifest); | |
| 122 | + if( N<numManifests ) return azManifests[N]; | |
| 123 | + N -= numManifests; | |
| 111 | 124 | } |
| 112 | 125 | if( !omitRepo && N<count(azRepo) ) return azRepo[N]; |
| 113 | 126 | return 0; |
| 114 | 127 | } |
| 115 | 128 | |
| 116 | 129 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -71,29 +71,42 @@ | |
| 71 | ".fos-journal", |
| 72 | ".fos-wal", |
| 73 | ".fos-shm", |
| 74 | }; |
| 75 | |
| 76 | /* Names of auxiliary files generated by SQLite when the "manifest" |
| 77 | ** property is enabled |
| 78 | */ |
| 79 | static const char *const azManifest[] = { |
| 80 | "manifest", |
| 81 | "manifest.uuid", |
| 82 | }; |
| 83 | |
| 84 | /* |
| 85 | ** Names of repository files, if they exist in the checkout. |
| 86 | */ |
| 87 | static const char *azRepo[4] = { 0, 0, 0, 0 }; |
| 88 | |
| 89 | /* Cached setting "manifest" */ |
| 90 | static int cachedManifest = -1; |
| 91 | |
| 92 | if( cachedManifest == -1 ){ |
| 93 | Blob repo; |
| 94 | cachedManifest = db_get_boolean("manifest",0); |
| 95 | blob_zero(&repo); |
| 96 | if( file_tree_name(g.zRepositoryName, &repo, 0, 0) ){ |
| 97 | const char *zRepo = blob_str(&repo); |
| 98 | azRepo[0] = zRepo; |
| 99 | azRepo[1] = mprintf("%s-journal", zRepo); |
| @@ -104,12 +117,12 @@ | |
| 104 | |
| 105 | if( N<0 ) return 0; |
| 106 | if( N<count(azName) ) return azName[N]; |
| 107 | N -= count(azName); |
| 108 | if( cachedManifest ){ |
| 109 | if( N<count(azManifest) ) return azManifest[N]; |
| 110 | N -= count(azManifest); |
| 111 | } |
| 112 | if( !omitRepo && N<count(azRepo) ) return azRepo[N]; |
| 113 | return 0; |
| 114 | } |
| 115 | |
| 116 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -71,29 +71,42 @@ | |
| 71 | ".fos-journal", |
| 72 | ".fos-wal", |
| 73 | ".fos-shm", |
| 74 | }; |
| 75 | |
| 76 | /* Possible names of auxiliary files generated when the "manifest" property |
| 77 | ** is used |
| 78 | */ |
| 79 | static const struct { |
| 80 | const char *fname; |
| 81 | int flg; |
| 82 | }aManifestflags[] = { |
| 83 | { "manifest", MFESTFLG_RAW }, |
| 84 | { "manifest.uuid", MFESTFLG_UUID }, |
| 85 | { "manifest.tags", MFESTFLG_TAGS } |
| 86 | }; |
| 87 | static const char *azManifests[3]; |
| 88 | |
| 89 | /* |
| 90 | ** Names of repository files, if they exist in the checkout. |
| 91 | */ |
| 92 | static const char *azRepo[4] = { 0, 0, 0, 0 }; |
| 93 | |
| 94 | /* Cached setting "manifest" */ |
| 95 | static int cachedManifest = -1; |
| 96 | static int numManifests; |
| 97 | |
| 98 | if( cachedManifest == -1 ){ |
| 99 | int i; |
| 100 | Blob repo; |
| 101 | cachedManifest = db_get_manifest_setting(); |
| 102 | numManifests = 0; |
| 103 | for(i=0; i<count(aManifestflags); i++){ |
| 104 | if( cachedManifest&aManifestflags[i].flg ) { |
| 105 | azManifests[numManifests++] = aManifestflags[i].fname; |
| 106 | } |
| 107 | } |
| 108 | blob_zero(&repo); |
| 109 | if( file_tree_name(g.zRepositoryName, &repo, 0, 0) ){ |
| 110 | const char *zRepo = blob_str(&repo); |
| 111 | azRepo[0] = zRepo; |
| 112 | azRepo[1] = mprintf("%s-journal", zRepo); |
| @@ -104,12 +117,12 @@ | |
| 117 | |
| 118 | if( N<0 ) return 0; |
| 119 | if( N<count(azName) ) return azName[N]; |
| 120 | N -= count(azName); |
| 121 | if( cachedManifest ){ |
| 122 | if( N<numManifests ) return azManifests[N]; |
| 123 | N -= numManifests; |
| 124 | } |
| 125 | if( !omitRepo && N<count(azRepo) ) return azRepo[N]; |
| 126 | return 0; |
| 127 | } |
| 128 | |
| 129 |