Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Warn when there's a versioned and non-versioned value for a setting, and allow this warning to be silenced. Trim whitespace from settings loaded from files. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | versionable-settings |
| Files: | files | file ages | folders |
| SHA1: |
761a98a1ee390b928c7691793a7cac5b |
| User & Date: | ben 2011-05-28 09:15:48.920 |
Context
|
2011-05-28
| ||
| 14:55 | Docs and visibility for versionable settings: Add versionable marker in the web UI. Output of the settings command notes if the value is overridden. Update help text for settings command noting versionable status and that glob settings can be newline separated. check-in: b5d4526211 user: ben tags: versionable-settings | |
| 09:15 | Warn when there's a versioned and non-versioned value for a setting, and allow this warning to be silenced. Trim whitespace from settings loaded from files. check-in: 761a98a1ee user: ben tags: versionable-settings | |
|
2011-05-24
| ||
| 12:02 | Merge the latest trunk changes into the versionable-settings branch. check-in: 9c915adb0a user: drh tags: versionable-settings | |
Changes
Changes to src/db.c.
| ︙ | ︙ | |||
1393 1394 1395 1396 1397 1398 1399 |
}
}
/*
** Get a potentially versioned setting - either from .fossil-settings/<name>
*/
char *db_get_versionable_setting(const char *zName, char *zDefault){
| > > | < | > | > > > > > | > | > > > | | | 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 |
}
}
/*
** Get a potentially versioned setting - either from .fossil-settings/<name>
*/
char *db_get_versionable_setting(const char *zName, char *zDefault){
/* Attempt to load the versioned setting from a checked out file */
char *zVersionedSetting = 0;
int noWarn = 0;
if( db_open_local() ){
Blob versionedPathname;
blob_zero(&versionedPathname);
blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", g.zLocalRoot, zName);
char *zVersionedPathname = blob_str(&versionedPathname);
if( file_size(zVersionedPathname)>=0 ){
/* File exists, and contains the value for this setting. Load from the file. */
Blob setting;
blob_zero(&setting);
if( blob_read_from_file(&setting, zVersionedPathname) >= 0 ){
blob_trim(&setting); /* Avoid non-obvious problems with line endings on boolean properties */
zVersionedSetting = strdup(blob_str(&setting));
}
blob_reset(&setting);
/* See if there's a no-warn flag */
blob_append(&versionedPathname, ".no-warn", -1);
if( file_size(blob_str(&versionedPathname))>=0 ){
noWarn = 1;
}
}
blob_reset(&versionedPathname);
}
/* Load the normal, non-versioned setting */
char *zSetting = db_get(zName, zDefault);
/* Display a warning? */
if( zVersionedSetting!=0 && zSetting!=0 && zSetting[0]!='\0' && zSetting!=zDefault && !noWarn ){
/* There's a versioned setting, and a non-versioned setting. Tell the user about the conflict */
fossil_warning("Setting %s has both versioned and non-versioned values: using versioned value from file .fossil-settings/%s (To silence this warning, either create an empty file named .fossil-settings/%s.no-warn or delete the non-versioned setting with \"fossil unset %s\")", zName, zName, zName, zName);
}
/* Prefer the versioned setting */
return ( zVersionedSetting!=0 ) ? zVersionedSetting : zSetting;
}
int db_get_versionable_setting_boolean(const char *zName, int dflt){
char *zVal = db_get_versionable_setting(zName, dflt ? "on" : "off");
if( is_truth(zVal) ) return 1;
if( is_false(zVal) ) return 0;
return dflt;
}
|
| ︙ | ︙ |