Fossil SCM
Make all files mentioned by a public manifest public as well. Ticket [5f194e2c8f475c].
Commit
2985120d93c5fa77657d57a26eb181c7ee27ff38
Parent
f2359f22c2c6f8f…
1 file changed
+15
-7
+15
-7
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -1102,10 +1102,11 @@ | ||
| 1102 | 1102 | int mid, /* The record ID of the manifest */ |
| 1103 | 1103 | const char *zFromUuid, /* UUID for the mlink.pid. "" to add file */ |
| 1104 | 1104 | const char *zToUuid, /* UUID for the mlink.fid. "" to delele */ |
| 1105 | 1105 | const char *zFilename, /* Filename */ |
| 1106 | 1106 | const char *zPrior, /* Previous filename. NULL if unchanged */ |
| 1107 | + int isPublic, /* True if mid is not a private manifest */ | |
| 1107 | 1108 | int mperm /* 1: exec */ |
| 1108 | 1109 | ){ |
| 1109 | 1110 | int fnid, pfnid, pid, fid; |
| 1110 | 1111 | static Stmt s1; |
| 1111 | 1112 | |
| @@ -1122,10 +1123,11 @@ | ||
| 1122 | 1123 | } |
| 1123 | 1124 | if( zToUuid==0 || zToUuid[0]==0 ){ |
| 1124 | 1125 | fid = 0; |
| 1125 | 1126 | }else{ |
| 1126 | 1127 | fid = uuid_to_rid(zToUuid, 1); |
| 1128 | + if( isPublic ) content_make_public(fid); | |
| 1127 | 1129 | } |
| 1128 | 1130 | db_static_prepare(&s1, |
| 1129 | 1131 | "INSERT INTO mlink(mid,pid,fid,fnid,pfnid,mperm)" |
| 1130 | 1132 | "VALUES(:m,:p,:f,:n,:pfn,:mp)" |
| 1131 | 1133 | ); |
| @@ -1220,10 +1222,11 @@ | ||
| 1220 | 1222 | int otherRid; |
| 1221 | 1223 | int i, rc; |
| 1222 | 1224 | ManifestFile *pChildFile, *pParentFile; |
| 1223 | 1225 | Manifest **ppOther; |
| 1224 | 1226 | static Stmt eq; |
| 1227 | + int isPublic; /* True if pChild is non-private */ | |
| 1225 | 1228 | |
| 1226 | 1229 | /* If mlink table entires are already set for cid, then abort early |
| 1227 | 1230 | ** doing no work. |
| 1228 | 1231 | */ |
| 1229 | 1232 | db_static_prepare(&eq, "SELECT 1 FROM mlink WHERE mid=:mid"); |
| @@ -1251,10 +1254,11 @@ | ||
| 1251 | 1254 | } |
| 1252 | 1255 | if( fetch_baseline(pParent, 0) || fetch_baseline(pChild, 0) ){ |
| 1253 | 1256 | manifest_destroy(*ppOther); |
| 1254 | 1257 | return; |
| 1255 | 1258 | } |
| 1259 | + isPublic = !content_is_private(cid); | |
| 1256 | 1260 | |
| 1257 | 1261 | /* Try to make the parent manifest a delta from the child, if that |
| 1258 | 1262 | ** is an appropriate thing to do. For a new baseline, make the |
| 1259 | 1263 | ** previoius baseline a delta from the current baseline. |
| 1260 | 1264 | */ |
| @@ -1284,28 +1288,30 @@ | ||
| 1284 | 1288 | if( pChildFile->zPrior ){ |
| 1285 | 1289 | pParentFile = manifest_file_seek(pParent, pChildFile->zPrior); |
| 1286 | 1290 | if( pParentFile ){ |
| 1287 | 1291 | /* File with name change */ |
| 1288 | 1292 | add_one_mlink(cid, pParentFile->zUuid, pChildFile->zUuid, |
| 1289 | - pChildFile->zName, pChildFile->zPrior, mperm); | |
| 1293 | + pChildFile->zName, pChildFile->zPrior, isPublic, mperm); | |
| 1290 | 1294 | }else{ |
| 1291 | 1295 | /* File name changed, but the old name is not found in the parent! |
| 1292 | 1296 | ** Treat this like a new file. */ |
| 1293 | - add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0, mperm); | |
| 1297 | + add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0, | |
| 1298 | + isPublic, mperm); | |
| 1294 | 1299 | } |
| 1295 | 1300 | }else{ |
| 1296 | 1301 | pParentFile = manifest_file_seek(pParent, pChildFile->zName); |
| 1297 | 1302 | if( pParentFile==0 ){ |
| 1298 | 1303 | if( pChildFile->zUuid ){ |
| 1299 | 1304 | /* A new file */ |
| 1300 | - add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName,0,mperm); | |
| 1305 | + add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0, | |
| 1306 | + isPublic, mperm); | |
| 1301 | 1307 | } |
| 1302 | 1308 | }else if( fossil_strcmp(pChildFile->zUuid, pParentFile->zUuid)!=0 |
| 1303 | 1309 | || manifest_file_mperm(pParentFile)!=mperm ){ |
| 1304 | 1310 | /* Changes in file content or permissions */ |
| 1305 | 1311 | add_one_mlink(cid, pParentFile->zUuid, pChildFile->zUuid, |
| 1306 | - pChildFile->zName, 0, mperm); | |
| 1312 | + pChildFile->zName, 0, isPublic, mperm); | |
| 1307 | 1313 | } |
| 1308 | 1314 | } |
| 1309 | 1315 | } |
| 1310 | 1316 | if( pParent->zBaseline && pChild->zBaseline ){ |
| 1311 | 1317 | /* Both parent and child are delta manifests. Look for files that |
| @@ -1314,11 +1320,11 @@ | ||
| 1314 | 1320 | for(i=0, pParentFile=pParent->aFile; i<pParent->nFile; i++, pParentFile++){ |
| 1315 | 1321 | if( pParentFile->zUuid ) continue; |
| 1316 | 1322 | pChildFile = manifest_file_seek(pChild, pParentFile->zName); |
| 1317 | 1323 | if( pChildFile ){ |
| 1318 | 1324 | add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0, |
| 1319 | - manifest_file_mperm(pChildFile)); | |
| 1325 | + isPublic, manifest_file_mperm(pChildFile)); | |
| 1320 | 1326 | } |
| 1321 | 1327 | } |
| 1322 | 1328 | }else if( pChild->zBaseline==0 ){ |
| 1323 | 1329 | /* Parent is a delta but pChild is a baseline. Look for files that are |
| 1324 | 1330 | ** present in pParent but which are missing from pChild and mark them |
| @@ -1325,11 +1331,12 @@ | ||
| 1325 | 1331 | ** has having been deleted. */ |
| 1326 | 1332 | manifest_file_rewind(pParent); |
| 1327 | 1333 | while( (pParentFile = manifest_file_next(pParent,0))!=0 ){ |
| 1328 | 1334 | pChildFile = manifest_file_seek(pChild, pParentFile->zName); |
| 1329 | 1335 | if( pChildFile==0 ){ |
| 1330 | - add_one_mlink(cid, pParentFile->zUuid, 0, pParentFile->zName, 0, 0); | |
| 1336 | + add_one_mlink(cid, pParentFile->zUuid, 0, pParentFile->zName, 0, | |
| 1337 | + isPublic, 0); | |
| 1331 | 1338 | } |
| 1332 | 1339 | } |
| 1333 | 1340 | } |
| 1334 | 1341 | manifest_cache_insert(*ppOther); |
| 1335 | 1342 | } |
| @@ -1560,13 +1567,14 @@ | ||
| 1560 | 1567 | } |
| 1561 | 1568 | db_finalize(&q); |
| 1562 | 1569 | if( p->nParent==0 ){ |
| 1563 | 1570 | /* For root files (files without parents) add mlink entries |
| 1564 | 1571 | ** showing all content as new. */ |
| 1572 | + int isPublic = !content_is_private(rid); | |
| 1565 | 1573 | for(i=0; i<p->nFile; i++){ |
| 1566 | 1574 | add_one_mlink(rid, 0, p->aFile[i].zUuid, p->aFile[i].zName, 0, |
| 1567 | - manifest_file_mperm(&p->aFile[i])); | |
| 1575 | + isPublic, manifest_file_mperm(&p->aFile[i])); | |
| 1568 | 1576 | } |
| 1569 | 1577 | } |
| 1570 | 1578 | db_multi_exec( |
| 1571 | 1579 | "REPLACE INTO event(type,mtime,objid,user,comment," |
| 1572 | 1580 | "bgcolor,euser,ecomment,omtime)" |
| 1573 | 1581 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -1102,10 +1102,11 @@ | |
| 1102 | int mid, /* The record ID of the manifest */ |
| 1103 | const char *zFromUuid, /* UUID for the mlink.pid. "" to add file */ |
| 1104 | const char *zToUuid, /* UUID for the mlink.fid. "" to delele */ |
| 1105 | const char *zFilename, /* Filename */ |
| 1106 | const char *zPrior, /* Previous filename. NULL if unchanged */ |
| 1107 | int mperm /* 1: exec */ |
| 1108 | ){ |
| 1109 | int fnid, pfnid, pid, fid; |
| 1110 | static Stmt s1; |
| 1111 | |
| @@ -1122,10 +1123,11 @@ | |
| 1122 | } |
| 1123 | if( zToUuid==0 || zToUuid[0]==0 ){ |
| 1124 | fid = 0; |
| 1125 | }else{ |
| 1126 | fid = uuid_to_rid(zToUuid, 1); |
| 1127 | } |
| 1128 | db_static_prepare(&s1, |
| 1129 | "INSERT INTO mlink(mid,pid,fid,fnid,pfnid,mperm)" |
| 1130 | "VALUES(:m,:p,:f,:n,:pfn,:mp)" |
| 1131 | ); |
| @@ -1220,10 +1222,11 @@ | |
| 1220 | int otherRid; |
| 1221 | int i, rc; |
| 1222 | ManifestFile *pChildFile, *pParentFile; |
| 1223 | Manifest **ppOther; |
| 1224 | static Stmt eq; |
| 1225 | |
| 1226 | /* If mlink table entires are already set for cid, then abort early |
| 1227 | ** doing no work. |
| 1228 | */ |
| 1229 | db_static_prepare(&eq, "SELECT 1 FROM mlink WHERE mid=:mid"); |
| @@ -1251,10 +1254,11 @@ | |
| 1251 | } |
| 1252 | if( fetch_baseline(pParent, 0) || fetch_baseline(pChild, 0) ){ |
| 1253 | manifest_destroy(*ppOther); |
| 1254 | return; |
| 1255 | } |
| 1256 | |
| 1257 | /* Try to make the parent manifest a delta from the child, if that |
| 1258 | ** is an appropriate thing to do. For a new baseline, make the |
| 1259 | ** previoius baseline a delta from the current baseline. |
| 1260 | */ |
| @@ -1284,28 +1288,30 @@ | |
| 1284 | if( pChildFile->zPrior ){ |
| 1285 | pParentFile = manifest_file_seek(pParent, pChildFile->zPrior); |
| 1286 | if( pParentFile ){ |
| 1287 | /* File with name change */ |
| 1288 | add_one_mlink(cid, pParentFile->zUuid, pChildFile->zUuid, |
| 1289 | pChildFile->zName, pChildFile->zPrior, mperm); |
| 1290 | }else{ |
| 1291 | /* File name changed, but the old name is not found in the parent! |
| 1292 | ** Treat this like a new file. */ |
| 1293 | add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0, mperm); |
| 1294 | } |
| 1295 | }else{ |
| 1296 | pParentFile = manifest_file_seek(pParent, pChildFile->zName); |
| 1297 | if( pParentFile==0 ){ |
| 1298 | if( pChildFile->zUuid ){ |
| 1299 | /* A new file */ |
| 1300 | add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName,0,mperm); |
| 1301 | } |
| 1302 | }else if( fossil_strcmp(pChildFile->zUuid, pParentFile->zUuid)!=0 |
| 1303 | || manifest_file_mperm(pParentFile)!=mperm ){ |
| 1304 | /* Changes in file content or permissions */ |
| 1305 | add_one_mlink(cid, pParentFile->zUuid, pChildFile->zUuid, |
| 1306 | pChildFile->zName, 0, mperm); |
| 1307 | } |
| 1308 | } |
| 1309 | } |
| 1310 | if( pParent->zBaseline && pChild->zBaseline ){ |
| 1311 | /* Both parent and child are delta manifests. Look for files that |
| @@ -1314,11 +1320,11 @@ | |
| 1314 | for(i=0, pParentFile=pParent->aFile; i<pParent->nFile; i++, pParentFile++){ |
| 1315 | if( pParentFile->zUuid ) continue; |
| 1316 | pChildFile = manifest_file_seek(pChild, pParentFile->zName); |
| 1317 | if( pChildFile ){ |
| 1318 | add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0, |
| 1319 | manifest_file_mperm(pChildFile)); |
| 1320 | } |
| 1321 | } |
| 1322 | }else if( pChild->zBaseline==0 ){ |
| 1323 | /* Parent is a delta but pChild is a baseline. Look for files that are |
| 1324 | ** present in pParent but which are missing from pChild and mark them |
| @@ -1325,11 +1331,12 @@ | |
| 1325 | ** has having been deleted. */ |
| 1326 | manifest_file_rewind(pParent); |
| 1327 | while( (pParentFile = manifest_file_next(pParent,0))!=0 ){ |
| 1328 | pChildFile = manifest_file_seek(pChild, pParentFile->zName); |
| 1329 | if( pChildFile==0 ){ |
| 1330 | add_one_mlink(cid, pParentFile->zUuid, 0, pParentFile->zName, 0, 0); |
| 1331 | } |
| 1332 | } |
| 1333 | } |
| 1334 | manifest_cache_insert(*ppOther); |
| 1335 | } |
| @@ -1560,13 +1567,14 @@ | |
| 1560 | } |
| 1561 | db_finalize(&q); |
| 1562 | if( p->nParent==0 ){ |
| 1563 | /* For root files (files without parents) add mlink entries |
| 1564 | ** showing all content as new. */ |
| 1565 | for(i=0; i<p->nFile; i++){ |
| 1566 | add_one_mlink(rid, 0, p->aFile[i].zUuid, p->aFile[i].zName, 0, |
| 1567 | manifest_file_mperm(&p->aFile[i])); |
| 1568 | } |
| 1569 | } |
| 1570 | db_multi_exec( |
| 1571 | "REPLACE INTO event(type,mtime,objid,user,comment," |
| 1572 | "bgcolor,euser,ecomment,omtime)" |
| 1573 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -1102,10 +1102,11 @@ | |
| 1102 | int mid, /* The record ID of the manifest */ |
| 1103 | const char *zFromUuid, /* UUID for the mlink.pid. "" to add file */ |
| 1104 | const char *zToUuid, /* UUID for the mlink.fid. "" to delele */ |
| 1105 | const char *zFilename, /* Filename */ |
| 1106 | const char *zPrior, /* Previous filename. NULL if unchanged */ |
| 1107 | int isPublic, /* True if mid is not a private manifest */ |
| 1108 | int mperm /* 1: exec */ |
| 1109 | ){ |
| 1110 | int fnid, pfnid, pid, fid; |
| 1111 | static Stmt s1; |
| 1112 | |
| @@ -1122,10 +1123,11 @@ | |
| 1123 | } |
| 1124 | if( zToUuid==0 || zToUuid[0]==0 ){ |
| 1125 | fid = 0; |
| 1126 | }else{ |
| 1127 | fid = uuid_to_rid(zToUuid, 1); |
| 1128 | if( isPublic ) content_make_public(fid); |
| 1129 | } |
| 1130 | db_static_prepare(&s1, |
| 1131 | "INSERT INTO mlink(mid,pid,fid,fnid,pfnid,mperm)" |
| 1132 | "VALUES(:m,:p,:f,:n,:pfn,:mp)" |
| 1133 | ); |
| @@ -1220,10 +1222,11 @@ | |
| 1222 | int otherRid; |
| 1223 | int i, rc; |
| 1224 | ManifestFile *pChildFile, *pParentFile; |
| 1225 | Manifest **ppOther; |
| 1226 | static Stmt eq; |
| 1227 | int isPublic; /* True if pChild is non-private */ |
| 1228 | |
| 1229 | /* If mlink table entires are already set for cid, then abort early |
| 1230 | ** doing no work. |
| 1231 | */ |
| 1232 | db_static_prepare(&eq, "SELECT 1 FROM mlink WHERE mid=:mid"); |
| @@ -1251,10 +1254,11 @@ | |
| 1254 | } |
| 1255 | if( fetch_baseline(pParent, 0) || fetch_baseline(pChild, 0) ){ |
| 1256 | manifest_destroy(*ppOther); |
| 1257 | return; |
| 1258 | } |
| 1259 | isPublic = !content_is_private(cid); |
| 1260 | |
| 1261 | /* Try to make the parent manifest a delta from the child, if that |
| 1262 | ** is an appropriate thing to do. For a new baseline, make the |
| 1263 | ** previoius baseline a delta from the current baseline. |
| 1264 | */ |
| @@ -1284,28 +1288,30 @@ | |
| 1288 | if( pChildFile->zPrior ){ |
| 1289 | pParentFile = manifest_file_seek(pParent, pChildFile->zPrior); |
| 1290 | if( pParentFile ){ |
| 1291 | /* File with name change */ |
| 1292 | add_one_mlink(cid, pParentFile->zUuid, pChildFile->zUuid, |
| 1293 | pChildFile->zName, pChildFile->zPrior, isPublic, mperm); |
| 1294 | }else{ |
| 1295 | /* File name changed, but the old name is not found in the parent! |
| 1296 | ** Treat this like a new file. */ |
| 1297 | add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0, |
| 1298 | isPublic, mperm); |
| 1299 | } |
| 1300 | }else{ |
| 1301 | pParentFile = manifest_file_seek(pParent, pChildFile->zName); |
| 1302 | if( pParentFile==0 ){ |
| 1303 | if( pChildFile->zUuid ){ |
| 1304 | /* A new file */ |
| 1305 | add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0, |
| 1306 | isPublic, mperm); |
| 1307 | } |
| 1308 | }else if( fossil_strcmp(pChildFile->zUuid, pParentFile->zUuid)!=0 |
| 1309 | || manifest_file_mperm(pParentFile)!=mperm ){ |
| 1310 | /* Changes in file content or permissions */ |
| 1311 | add_one_mlink(cid, pParentFile->zUuid, pChildFile->zUuid, |
| 1312 | pChildFile->zName, 0, isPublic, mperm); |
| 1313 | } |
| 1314 | } |
| 1315 | } |
| 1316 | if( pParent->zBaseline && pChild->zBaseline ){ |
| 1317 | /* Both parent and child are delta manifests. Look for files that |
| @@ -1314,11 +1320,11 @@ | |
| 1320 | for(i=0, pParentFile=pParent->aFile; i<pParent->nFile; i++, pParentFile++){ |
| 1321 | if( pParentFile->zUuid ) continue; |
| 1322 | pChildFile = manifest_file_seek(pChild, pParentFile->zName); |
| 1323 | if( pChildFile ){ |
| 1324 | add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0, |
| 1325 | isPublic, manifest_file_mperm(pChildFile)); |
| 1326 | } |
| 1327 | } |
| 1328 | }else if( pChild->zBaseline==0 ){ |
| 1329 | /* Parent is a delta but pChild is a baseline. Look for files that are |
| 1330 | ** present in pParent but which are missing from pChild and mark them |
| @@ -1325,11 +1331,12 @@ | |
| 1331 | ** has having been deleted. */ |
| 1332 | manifest_file_rewind(pParent); |
| 1333 | while( (pParentFile = manifest_file_next(pParent,0))!=0 ){ |
| 1334 | pChildFile = manifest_file_seek(pChild, pParentFile->zName); |
| 1335 | if( pChildFile==0 ){ |
| 1336 | add_one_mlink(cid, pParentFile->zUuid, 0, pParentFile->zName, 0, |
| 1337 | isPublic, 0); |
| 1338 | } |
| 1339 | } |
| 1340 | } |
| 1341 | manifest_cache_insert(*ppOther); |
| 1342 | } |
| @@ -1560,13 +1567,14 @@ | |
| 1567 | } |
| 1568 | db_finalize(&q); |
| 1569 | if( p->nParent==0 ){ |
| 1570 | /* For root files (files without parents) add mlink entries |
| 1571 | ** showing all content as new. */ |
| 1572 | int isPublic = !content_is_private(rid); |
| 1573 | for(i=0; i<p->nFile; i++){ |
| 1574 | add_one_mlink(rid, 0, p->aFile[i].zUuid, p->aFile[i].zName, 0, |
| 1575 | isPublic, manifest_file_mperm(&p->aFile[i])); |
| 1576 | } |
| 1577 | } |
| 1578 | db_multi_exec( |
| 1579 | "REPLACE INTO event(type,mtime,objid,user,comment," |
| 1580 | "bgcolor,euser,ecomment,omtime)" |
| 1581 |