Fossil SCM
Use "win32-longpath" as default (when available, overridable with FOSSIL_VFS environment variable) when accessing peer repositories.
Commit
f8eefabe6a9d3dbf867504bd00dfc398a86ac230
Parent
81d24c6bfe5fed6…
1 file changed
+20
-2
+20
-2
| --- src/login.c | ||
| +++ src/login.c | ||
| @@ -688,18 +688,27 @@ | ||
| 688 | 688 | sqlite3_stmt *pStmt; /* Query against the other repository */ |
| 689 | 689 | char *zSQL; /* SQL of the query against other repo */ |
| 690 | 690 | char *zOtherRepo; /* Filename of the other repository */ |
| 691 | 691 | int rc; /* Result code from SQLite library functions */ |
| 692 | 692 | int nXfer = 0; /* Number of credentials transferred */ |
| 693 | + const char *zVfs; | |
| 693 | 694 | |
| 694 | 695 | zOtherRepo = db_text(0, |
| 695 | 696 | "SELECT value FROM config WHERE name='peer-repo-%q'", |
| 696 | 697 | zCode |
| 697 | 698 | ); |
| 698 | 699 | if( zOtherRepo==0 ) return 0; /* No such peer repository */ |
| 699 | 700 | |
| 700 | - rc = sqlite3_open(zOtherRepo, &pOther); | |
| 701 | + zVfs = fossil_getenv("FOSSIL_VFS"); | |
| 702 | +#if defined(_WIN32) || defined(__CYGWIN__) | |
| 703 | + if( zVfs==0 && sqlite3_libversion_number()>=3008001 ){ | |
| 704 | + zVfs = "win32-longpath"; | |
| 705 | + } | |
| 706 | +#endif | |
| 707 | + rc = sqlite3_open_v2(zOtherRepo, &pOther, | |
| 708 | + SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, | |
| 709 | + zVfs); | |
| 701 | 710 | if( rc==SQLITE_OK ){ |
| 702 | 711 | sqlite3_create_function(pOther,"now",0,SQLITE_ANY,0,db_now_function,0,0); |
| 703 | 712 | sqlite3_create_function(pOther, "constant_time_cmp", 2, SQLITE_UTF8, 0, |
| 704 | 713 | constant_time_cmp_function, 0, 0); |
| 705 | 714 | sqlite3_busy_timeout(pOther, 5000); |
| @@ -1428,10 +1437,11 @@ | ||
| 1428 | 1437 | char *zSelfRepo; /* Name of our repository */ |
| 1429 | 1438 | char *zSelfLabel; /* Project-name for our repository */ |
| 1430 | 1439 | char *zSelfProjCode; /* Our project-code */ |
| 1431 | 1440 | char *zSql; /* SQL to run on all peers */ |
| 1432 | 1441 | const char *zSelf; /* The ATTACH name of our repository */ |
| 1442 | + const char *zVfs; | |
| 1433 | 1443 | |
| 1434 | 1444 | *pzErrMsg = 0; /* Default to no errors */ |
| 1435 | 1445 | zSelf = db_name("repository"); |
| 1436 | 1446 | |
| 1437 | 1447 | /* Get the full pathname of the other repository */ |
| @@ -1459,11 +1469,19 @@ | ||
| 1459 | 1469 | /* Make sure the other repository is a valid Fossil database */ |
| 1460 | 1470 | if( file_size(zRepo)<0 ){ |
| 1461 | 1471 | *pzErrMsg = mprintf("repository file \"%s\" does not exist", zRepo); |
| 1462 | 1472 | return; |
| 1463 | 1473 | } |
| 1464 | - rc = sqlite3_open(zRepo, &pOther); | |
| 1474 | + zVfs = fossil_getenv("FOSSIL_VFS"); | |
| 1475 | +#if defined(_WIN32) || defined(__CYGWIN__) | |
| 1476 | + if( zVfs==0 && sqlite3_libversion_number()>=3008001 ){ | |
| 1477 | + zVfs = "win32-longpath"; | |
| 1478 | + } | |
| 1479 | +#endif | |
| 1480 | + rc = sqlite3_open_v2(zRepo, &pOther, | |
| 1481 | + SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, | |
| 1482 | + zVfs); | |
| 1465 | 1483 | if( rc!=SQLITE_OK ){ |
| 1466 | 1484 | *pzErrMsg = mprintf(sqlite3_errmsg(pOther)); |
| 1467 | 1485 | }else{ |
| 1468 | 1486 | rc = sqlite3_exec(pOther, "SELECT count(*) FROM user", 0, 0, pzErrMsg); |
| 1469 | 1487 | } |
| 1470 | 1488 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -688,18 +688,27 @@ | |
| 688 | sqlite3_stmt *pStmt; /* Query against the other repository */ |
| 689 | char *zSQL; /* SQL of the query against other repo */ |
| 690 | char *zOtherRepo; /* Filename of the other repository */ |
| 691 | int rc; /* Result code from SQLite library functions */ |
| 692 | int nXfer = 0; /* Number of credentials transferred */ |
| 693 | |
| 694 | zOtherRepo = db_text(0, |
| 695 | "SELECT value FROM config WHERE name='peer-repo-%q'", |
| 696 | zCode |
| 697 | ); |
| 698 | if( zOtherRepo==0 ) return 0; /* No such peer repository */ |
| 699 | |
| 700 | rc = sqlite3_open(zOtherRepo, &pOther); |
| 701 | if( rc==SQLITE_OK ){ |
| 702 | sqlite3_create_function(pOther,"now",0,SQLITE_ANY,0,db_now_function,0,0); |
| 703 | sqlite3_create_function(pOther, "constant_time_cmp", 2, SQLITE_UTF8, 0, |
| 704 | constant_time_cmp_function, 0, 0); |
| 705 | sqlite3_busy_timeout(pOther, 5000); |
| @@ -1428,10 +1437,11 @@ | |
| 1428 | char *zSelfRepo; /* Name of our repository */ |
| 1429 | char *zSelfLabel; /* Project-name for our repository */ |
| 1430 | char *zSelfProjCode; /* Our project-code */ |
| 1431 | char *zSql; /* SQL to run on all peers */ |
| 1432 | const char *zSelf; /* The ATTACH name of our repository */ |
| 1433 | |
| 1434 | *pzErrMsg = 0; /* Default to no errors */ |
| 1435 | zSelf = db_name("repository"); |
| 1436 | |
| 1437 | /* Get the full pathname of the other repository */ |
| @@ -1459,11 +1469,19 @@ | |
| 1459 | /* Make sure the other repository is a valid Fossil database */ |
| 1460 | if( file_size(zRepo)<0 ){ |
| 1461 | *pzErrMsg = mprintf("repository file \"%s\" does not exist", zRepo); |
| 1462 | return; |
| 1463 | } |
| 1464 | rc = sqlite3_open(zRepo, &pOther); |
| 1465 | if( rc!=SQLITE_OK ){ |
| 1466 | *pzErrMsg = mprintf(sqlite3_errmsg(pOther)); |
| 1467 | }else{ |
| 1468 | rc = sqlite3_exec(pOther, "SELECT count(*) FROM user", 0, 0, pzErrMsg); |
| 1469 | } |
| 1470 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -688,18 +688,27 @@ | |
| 688 | sqlite3_stmt *pStmt; /* Query against the other repository */ |
| 689 | char *zSQL; /* SQL of the query against other repo */ |
| 690 | char *zOtherRepo; /* Filename of the other repository */ |
| 691 | int rc; /* Result code from SQLite library functions */ |
| 692 | int nXfer = 0; /* Number of credentials transferred */ |
| 693 | const char *zVfs; |
| 694 | |
| 695 | zOtherRepo = db_text(0, |
| 696 | "SELECT value FROM config WHERE name='peer-repo-%q'", |
| 697 | zCode |
| 698 | ); |
| 699 | if( zOtherRepo==0 ) return 0; /* No such peer repository */ |
| 700 | |
| 701 | zVfs = fossil_getenv("FOSSIL_VFS"); |
| 702 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 703 | if( zVfs==0 && sqlite3_libversion_number()>=3008001 ){ |
| 704 | zVfs = "win32-longpath"; |
| 705 | } |
| 706 | #endif |
| 707 | rc = sqlite3_open_v2(zOtherRepo, &pOther, |
| 708 | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, |
| 709 | zVfs); |
| 710 | if( rc==SQLITE_OK ){ |
| 711 | sqlite3_create_function(pOther,"now",0,SQLITE_ANY,0,db_now_function,0,0); |
| 712 | sqlite3_create_function(pOther, "constant_time_cmp", 2, SQLITE_UTF8, 0, |
| 713 | constant_time_cmp_function, 0, 0); |
| 714 | sqlite3_busy_timeout(pOther, 5000); |
| @@ -1428,10 +1437,11 @@ | |
| 1437 | char *zSelfRepo; /* Name of our repository */ |
| 1438 | char *zSelfLabel; /* Project-name for our repository */ |
| 1439 | char *zSelfProjCode; /* Our project-code */ |
| 1440 | char *zSql; /* SQL to run on all peers */ |
| 1441 | const char *zSelf; /* The ATTACH name of our repository */ |
| 1442 | const char *zVfs; |
| 1443 | |
| 1444 | *pzErrMsg = 0; /* Default to no errors */ |
| 1445 | zSelf = db_name("repository"); |
| 1446 | |
| 1447 | /* Get the full pathname of the other repository */ |
| @@ -1459,11 +1469,19 @@ | |
| 1469 | /* Make sure the other repository is a valid Fossil database */ |
| 1470 | if( file_size(zRepo)<0 ){ |
| 1471 | *pzErrMsg = mprintf("repository file \"%s\" does not exist", zRepo); |
| 1472 | return; |
| 1473 | } |
| 1474 | zVfs = fossil_getenv("FOSSIL_VFS"); |
| 1475 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 1476 | if( zVfs==0 && sqlite3_libversion_number()>=3008001 ){ |
| 1477 | zVfs = "win32-longpath"; |
| 1478 | } |
| 1479 | #endif |
| 1480 | rc = sqlite3_open_v2(zRepo, &pOther, |
| 1481 | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, |
| 1482 | zVfs); |
| 1483 | if( rc!=SQLITE_OK ){ |
| 1484 | *pzErrMsg = mprintf(sqlite3_errmsg(pOther)); |
| 1485 | }else{ |
| 1486 | rc = sqlite3_exec(pOther, "SELECT count(*) FROM user", 0, 0, pzErrMsg); |
| 1487 | } |
| 1488 |