Fossil SCM

Make "fossil import" without --force or --incremental refuse a repository file that already exists, naming the file and --force, as init and clone do. It used to fail with an SQL error about the blob table.

dmestas 2026-11-20 21:26 UTC small-fixes
Commit 0c4b612f4e63b41ecb1d1ba837efe1ce4fb4e12d81ce2119a9f12811470fc254
1 file changed +6 -1
+6 -1
--- src/import.c
+++ src/import.c
@@ -1938,11 +1938,16 @@
19381938
}else{
19391939
pIn = stdin;
19401940
fossil_binary_mode(pIn);
19411941
}
19421942
if( !incrFlag ){
1943
- if( forceFlag ) file_delete(g.argv[2]);
1943
+ if( forceFlag ){
1944
+ file_delete(g.argv[2]);
1945
+ }else if( -1 != file_size(g.argv[2], ExtFILE) ){
1946
+ fossil_fatal("file already exists: %s (use --force to replace it)",
1947
+ g.argv[2]);
1948
+ }
19441949
db_create_repository(g.argv[2]);
19451950
}
19461951
db_open_repository(g.argv[2]);
19471952
db_open_config(0, 0);
19481953
db_unprotect(PROTECT_ALL);
19491954
--- src/import.c
+++ src/import.c
@@ -1938,11 +1938,16 @@
1938 }else{
1939 pIn = stdin;
1940 fossil_binary_mode(pIn);
1941 }
1942 if( !incrFlag ){
1943 if( forceFlag ) file_delete(g.argv[2]);
 
 
 
 
 
1944 db_create_repository(g.argv[2]);
1945 }
1946 db_open_repository(g.argv[2]);
1947 db_open_config(0, 0);
1948 db_unprotect(PROTECT_ALL);
1949
--- src/import.c
+++ src/import.c
@@ -1938,11 +1938,16 @@
1938 }else{
1939 pIn = stdin;
1940 fossil_binary_mode(pIn);
1941 }
1942 if( !incrFlag ){
1943 if( forceFlag ){
1944 file_delete(g.argv[2]);
1945 }else if( -1 != file_size(g.argv[2], ExtFILE) ){
1946 fossil_fatal("file already exists: %s (use --force to replace it)",
1947 g.argv[2]);
1948 }
1949 db_create_repository(g.argv[2]);
1950 }
1951 db_open_repository(g.argv[2]);
1952 db_open_config(0, 0);
1953 db_unprotect(PROTECT_ALL);
1954

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button