Fossil SCM

move "solution" closer to problem area, rather than too deeply abstracted in the machinery.

bch 2015-01-29 22:15 clobber_fixer
Commit 89cf250dda1face9c867b7751deaebd7dde98a4a
1 file changed +6 -5
+6 -5
--- src/db.c
+++ src/db.c
@@ -817,18 +817,13 @@
817817
** connection. An error results in process abort.
818818
*/
819819
LOCAL sqlite3 *db_open(const char *zDbName){
820820
int rc;
821821
sqlite3 *db;
822
- struct stat sb;
823822
824823
if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName);
825824
826
- if (0 == stat(zDbName, &sb)) {
827
- db_err("[%s]: %s", zDbName, "File already exists.");
828
- }
829
-
830825
rc = sqlite3_open_v2(
831826
zDbName, &db,
832827
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
833828
g.zVfsName
834829
);
@@ -1675,10 +1670,11 @@
16751670
char *zPassword;
16761671
const char *zTemplate; /* Repository from which to copy settings */
16771672
const char *zDate; /* Date of the initial check-in */
16781673
const char *zDefaultUser; /* Optional name of the default user */
16791674
int makeServerCodes;
1675
+ struct stat sb;
16801676
16811677
zTemplate = find_option("template",0,1);
16821678
zDate = find_option("date-override",0,1);
16831679
zDefaultUser = find_option("admin-user","A",1);
16841680
makeServerCodes = find_option("docker", 0, 0)==0;
@@ -1688,10 +1684,15 @@
16881684
verify_all_options();
16891685
16901686
if( g.argc!=3 ){
16911687
usage("REPOSITORY-NAME");
16921688
}
1689
+
1690
+ if (0 == stat(g.argv[2], &sb)) {
1691
+ fossil_fatal("[%s]: %s", g.argv[2], "File already exists.");
1692
+ }
1693
+
16931694
db_create_repository(g.argv[2]);
16941695
db_open_repository(g.argv[2]);
16951696
db_open_config(0);
16961697
if( zTemplate ) db_attach(zTemplate, "settingSrc");
16971698
db_begin_transaction();
16981699
--- src/db.c
+++ src/db.c
@@ -817,18 +817,13 @@
817 ** connection. An error results in process abort.
818 */
819 LOCAL sqlite3 *db_open(const char *zDbName){
820 int rc;
821 sqlite3 *db;
822 struct stat sb;
823
824 if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName);
825
826 if (0 == stat(zDbName, &sb)) {
827 db_err("[%s]: %s", zDbName, "File already exists.");
828 }
829
830 rc = sqlite3_open_v2(
831 zDbName, &db,
832 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
833 g.zVfsName
834 );
@@ -1675,10 +1670,11 @@
1675 char *zPassword;
1676 const char *zTemplate; /* Repository from which to copy settings */
1677 const char *zDate; /* Date of the initial check-in */
1678 const char *zDefaultUser; /* Optional name of the default user */
1679 int makeServerCodes;
 
1680
1681 zTemplate = find_option("template",0,1);
1682 zDate = find_option("date-override",0,1);
1683 zDefaultUser = find_option("admin-user","A",1);
1684 makeServerCodes = find_option("docker", 0, 0)==0;
@@ -1688,10 +1684,15 @@
1688 verify_all_options();
1689
1690 if( g.argc!=3 ){
1691 usage("REPOSITORY-NAME");
1692 }
 
 
 
 
 
1693 db_create_repository(g.argv[2]);
1694 db_open_repository(g.argv[2]);
1695 db_open_config(0);
1696 if( zTemplate ) db_attach(zTemplate, "settingSrc");
1697 db_begin_transaction();
1698
--- src/db.c
+++ src/db.c
@@ -817,18 +817,13 @@
817 ** connection. An error results in process abort.
818 */
819 LOCAL sqlite3 *db_open(const char *zDbName){
820 int rc;
821 sqlite3 *db;
 
822
823 if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName);
824
 
 
 
 
825 rc = sqlite3_open_v2(
826 zDbName, &db,
827 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
828 g.zVfsName
829 );
@@ -1675,10 +1670,11 @@
1670 char *zPassword;
1671 const char *zTemplate; /* Repository from which to copy settings */
1672 const char *zDate; /* Date of the initial check-in */
1673 const char *zDefaultUser; /* Optional name of the default user */
1674 int makeServerCodes;
1675 struct stat sb;
1676
1677 zTemplate = find_option("template",0,1);
1678 zDate = find_option("date-override",0,1);
1679 zDefaultUser = find_option("admin-user","A",1);
1680 makeServerCodes = find_option("docker", 0, 0)==0;
@@ -1688,10 +1684,15 @@
1684 verify_all_options();
1685
1686 if( g.argc!=3 ){
1687 usage("REPOSITORY-NAME");
1688 }
1689
1690 if (0 == stat(g.argv[2], &sb)) {
1691 fossil_fatal("[%s]: %s", g.argv[2], "File already exists.");
1692 }
1693
1694 db_create_repository(g.argv[2]);
1695 db_open_repository(g.argv[2]);
1696 db_open_config(0);
1697 if( zTemplate ) db_attach(zTemplate, "settingSrc");
1698 db_begin_transaction();
1699

Keyboard Shortcuts

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