| | @@ -1435,15 +1435,30 @@ |
| 1435 | 1435 | ** .fossil-settings/<name> , and emits warnings if necessary. |
| 1436 | 1436 | ** Returns the non-versioned value without modification if there is no |
| 1437 | 1437 | ** versioned value. |
| 1438 | 1438 | */ |
| 1439 | 1439 | static char *db_get_do_versionable(const char *zName, char *zNonVersionedSetting){ |
| 1440 | | - /* Attempt to load the versioned setting from a checked out file */ |
| 1441 | 1440 | char *zVersionedSetting = 0; |
| 1442 | 1441 | int noWarn = 0; |
| 1443 | | - |
| 1444 | | - if( db_open_local() ){ |
| 1442 | + struct _cacheEntry { |
| 1443 | + struct _cacheEntry *next; |
| 1444 | + const char *zName, *zValue; |
| 1445 | + } *cacheEntry = 0; |
| 1446 | + static struct _cacheEntry *cache = 0; |
| 1447 | + |
| 1448 | + /* Look up name in cache */ |
| 1449 | + cacheEntry = cache; |
| 1450 | + while( cacheEntry!=0 ){ |
| 1451 | + if( fossil_strcmp(cacheEntry->zName, zName)==0 ){ |
| 1452 | + zVersionedSetting = fossil_strdup(cacheEntry->zValue); |
| 1453 | + break; |
| 1454 | + } |
| 1455 | + cacheEntry = cacheEntry->next; |
| 1456 | + } |
| 1457 | + /* Attempt to read value from file in checkout if there wasn't a cache hit |
| 1458 | + ** and a checkout is open. */ |
| 1459 | + if( cacheEntry==0 && db_open_local() ){ |
| 1445 | 1460 | Blob versionedPathname; |
| 1446 | 1461 | char *zVersionedPathname; |
| 1447 | 1462 | blob_zero(&versionedPathname); |
| 1448 | 1463 | blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", |
| 1449 | 1464 | g.zLocalRoot, zName); |
| | @@ -1464,10 +1479,16 @@ |
| 1464 | 1479 | if( file_size(blob_str(&versionedPathname))>=0 ){ |
| 1465 | 1480 | noWarn = 1; |
| 1466 | 1481 | } |
| 1467 | 1482 | } |
| 1468 | 1483 | blob_reset(&versionedPathname); |
| 1484 | + /* Store result in cache, which can be the value or 0 if not found */ |
| 1485 | + cacheEntry = (struct _cacheEntry*)fossil_malloc(sizeof(struct _cacheEntry)); |
| 1486 | + cacheEntry->next = cache; |
| 1487 | + cacheEntry->zName = zName; |
| 1488 | + cacheEntry->zValue = fossil_strdup(zVersionedSetting); |
| 1489 | + cache = cacheEntry; |
| 1469 | 1490 | } |
| 1470 | 1491 | /* Display a warning? */ |
| 1471 | 1492 | if( zVersionedSetting!=0 && zNonVersionedSetting!=0 |
| 1472 | 1493 | && zNonVersionedSetting[0]!='\0' && !noWarn |
| 1473 | 1494 | ){ |
| 1474 | 1495 | |