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.
Commit
0c4b612f4e63b41ecb1d1ba837efe1ce4fb4e12d81ce2119a9f12811470fc254
Parent
149cdcff9112680…
1 file changed
+6
-1
+6
-1
| --- src/import.c | ||
| +++ src/import.c | ||
| @@ -1938,11 +1938,16 @@ | ||
| 1938 | 1938 | }else{ |
| 1939 | 1939 | pIn = stdin; |
| 1940 | 1940 | fossil_binary_mode(pIn); |
| 1941 | 1941 | } |
| 1942 | 1942 | 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 | + } | |
| 1944 | 1949 | db_create_repository(g.argv[2]); |
| 1945 | 1950 | } |
| 1946 | 1951 | db_open_repository(g.argv[2]); |
| 1947 | 1952 | db_open_config(0, 0); |
| 1948 | 1953 | db_unprotect(PROTECT_ALL); |
| 1949 | 1954 |
| --- 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 |