Fossil SCM
Merge the checkout_on_root_fix.
Commit
cbcd7056b6c3cba36c8cac8385d23517222116f3
Parent
927cacb3530c67e…
1 file changed
+3
-4
M
src/db.c
+3
-4
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -942,18 +942,17 @@ | ||
| 942 | 942 | static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" }; |
| 943 | 943 | |
| 944 | 944 | if( g.localOpen) return 1; |
| 945 | 945 | file_getcwd(zPwd, sizeof(zPwd)-20); |
| 946 | 946 | n = strlen(zPwd); |
| 947 | - if( n==1 && zPwd[0]=='/' ) zPwd[0] = '.'; | |
| 948 | 947 | while( n>0 ){ |
| 949 | 948 | for(i=0; i<count(aDbName); i++){ |
| 950 | 949 | sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "/%s", aDbName[i]); |
| 951 | 950 | if( isValidLocalDb(zPwd) ){ |
| 952 | 951 | /* Found a valid checkout database file */ |
| 953 | 952 | zPwd[n] = 0; |
| 954 | - while( n>1 && zPwd[n-1]=='/' ){ | |
| 953 | + while( n>0 && zPwd[n-1]=='/' ){ | |
| 955 | 954 | n--; |
| 956 | 955 | zPwd[n] = 0; |
| 957 | 956 | } |
| 958 | 957 | g.zLocalRoot = mprintf("%s/", zPwd); |
| 959 | 958 | g.localOpen = 1; |
| @@ -961,12 +960,12 @@ | ||
| 961 | 960 | db_open_repository(zDbName); |
| 962 | 961 | return 1; |
| 963 | 962 | } |
| 964 | 963 | } |
| 965 | 964 | n--; |
| 966 | - while( n>0 && zPwd[n]!='/' ){ n--; } | |
| 967 | - while( n>0 && zPwd[n-1]=='/' ){ n--; } | |
| 965 | + while( n>1 && zPwd[n]!='/' ){ n--; } | |
| 966 | + while( n>1 && zPwd[n-1]=='/' ){ n--; } | |
| 968 | 967 | zPwd[n] = 0; |
| 969 | 968 | } |
| 970 | 969 | |
| 971 | 970 | /* A checkout database file could not be found */ |
| 972 | 971 | return 0; |
| 973 | 972 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -942,18 +942,17 @@ | |
| 942 | static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" }; |
| 943 | |
| 944 | if( g.localOpen) return 1; |
| 945 | file_getcwd(zPwd, sizeof(zPwd)-20); |
| 946 | n = strlen(zPwd); |
| 947 | if( n==1 && zPwd[0]=='/' ) zPwd[0] = '.'; |
| 948 | while( n>0 ){ |
| 949 | for(i=0; i<count(aDbName); i++){ |
| 950 | sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "/%s", aDbName[i]); |
| 951 | if( isValidLocalDb(zPwd) ){ |
| 952 | /* Found a valid checkout database file */ |
| 953 | zPwd[n] = 0; |
| 954 | while( n>1 && zPwd[n-1]=='/' ){ |
| 955 | n--; |
| 956 | zPwd[n] = 0; |
| 957 | } |
| 958 | g.zLocalRoot = mprintf("%s/", zPwd); |
| 959 | g.localOpen = 1; |
| @@ -961,12 +960,12 @@ | |
| 961 | db_open_repository(zDbName); |
| 962 | return 1; |
| 963 | } |
| 964 | } |
| 965 | n--; |
| 966 | while( n>0 && zPwd[n]!='/' ){ n--; } |
| 967 | while( n>0 && zPwd[n-1]=='/' ){ n--; } |
| 968 | zPwd[n] = 0; |
| 969 | } |
| 970 | |
| 971 | /* A checkout database file could not be found */ |
| 972 | return 0; |
| 973 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -942,18 +942,17 @@ | |
| 942 | static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" }; |
| 943 | |
| 944 | if( g.localOpen) return 1; |
| 945 | file_getcwd(zPwd, sizeof(zPwd)-20); |
| 946 | n = strlen(zPwd); |
| 947 | while( n>0 ){ |
| 948 | for(i=0; i<count(aDbName); i++){ |
| 949 | sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "/%s", aDbName[i]); |
| 950 | if( isValidLocalDb(zPwd) ){ |
| 951 | /* Found a valid checkout database file */ |
| 952 | zPwd[n] = 0; |
| 953 | while( n>0 && zPwd[n-1]=='/' ){ |
| 954 | n--; |
| 955 | zPwd[n] = 0; |
| 956 | } |
| 957 | g.zLocalRoot = mprintf("%s/", zPwd); |
| 958 | g.localOpen = 1; |
| @@ -961,12 +960,12 @@ | |
| 960 | db_open_repository(zDbName); |
| 961 | return 1; |
| 962 | } |
| 963 | } |
| 964 | n--; |
| 965 | while( n>1 && zPwd[n]!='/' ){ n--; } |
| 966 | while( n>1 && zPwd[n-1]=='/' ){ n--; } |
| 967 | zPwd[n] = 0; |
| 968 | } |
| 969 | |
| 970 | /* A checkout database file could not be found */ |
| 971 | return 0; |
| 972 |