Fossil SCM
Do not allow "fossil open URL" without a --workdir option to work on a non-empty directory.
Commit
f0805380f7b4ddb7e040069a1a43cc4aa37e897e28e18134ec9c0a95b9af550b
Parent
08ab286028274cc…
1 file changed
+3
M
src/db.c
+3
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -3175,10 +3175,13 @@ | ||
| 3175 | 3175 | } |
| 3176 | 3176 | } |
| 3177 | 3177 | if( file_chdir(zWorkDir, 0) ){ |
| 3178 | 3178 | fossil_fatal("unable to make %s the working directory", zWorkDir); |
| 3179 | 3179 | } |
| 3180 | + }else if( keepFlag==0 && isUri && file_directory_size(".", 0, 1)>0 ){ | |
| 3181 | + fossil_fatal("directory %s is not empty\nuse \"--workdir .\" " | |
| 3182 | + "to override this error", zPwd); | |
| 3180 | 3183 | } |
| 3181 | 3184 | |
| 3182 | 3185 | if( db_open_local_v2(0, allowNested) ){ |
| 3183 | 3186 | fossil_fatal("there is already an open tree at %s", g.zLocalRoot); |
| 3184 | 3187 | } |
| 3185 | 3188 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -3175,10 +3175,13 @@ | |
| 3175 | } |
| 3176 | } |
| 3177 | if( file_chdir(zWorkDir, 0) ){ |
| 3178 | fossil_fatal("unable to make %s the working directory", zWorkDir); |
| 3179 | } |
| 3180 | } |
| 3181 | |
| 3182 | if( db_open_local_v2(0, allowNested) ){ |
| 3183 | fossil_fatal("there is already an open tree at %s", g.zLocalRoot); |
| 3184 | } |
| 3185 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -3175,10 +3175,13 @@ | |
| 3175 | } |
| 3176 | } |
| 3177 | if( file_chdir(zWorkDir, 0) ){ |
| 3178 | fossil_fatal("unable to make %s the working directory", zWorkDir); |
| 3179 | } |
| 3180 | }else if( keepFlag==0 && isUri && file_directory_size(".", 0, 1)>0 ){ |
| 3181 | fossil_fatal("directory %s is not empty\nuse \"--workdir .\" " |
| 3182 | "to override this error", zPwd); |
| 3183 | } |
| 3184 | |
| 3185 | if( db_open_local_v2(0, allowNested) ){ |
| 3186 | fossil_fatal("there is already an open tree at %s", g.zLocalRoot); |
| 3187 | } |
| 3188 |