Fossil

Check-in [45b060f08e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:get to fossil_stat() via file_size(), and additionally protect 0-byte files in "clone"
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | clobber_fixer
Files: files | file ages | folders
SHA1: 45b060f08ea6845a5599c84d21c87dcb60590c5b
User & Date: bch 2015-01-29 22:48:14.754
Context
2015-01-29
22:51
cleanup ws, unused variable check-in: 7670e65f6c user: bch tags: clobber_fixer
22:48
get to fossil_stat() via file_size(), and additionally protect 0-byte files in "clone" check-in: 45b060f08e user: bch tags: clobber_fixer
22:15
move "solution" closer to problem area, rather than too deeply abstracted in the machinery. check-in: 89cf250dda user: bch tags: clobber_fixer
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/clone.c.
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
  /* We should be done with options.. */
  verify_all_options();

  if( g.argc < 4 ){
    usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY");
  }
  db_open_config(0);
  if( file_size(g.argv[3])>0 ){
    fossil_fatal("file already exists: %s", g.argv[3]);
  }

  url_parse(g.argv[2], urlFlags);
  if( zDefaultUser==0 && g.url.user!=0 ) zDefaultUser = g.url.user;
  if( g.url.isFile ){
    file_copy(g.url.name, g.argv[3]);







|







136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
  /* We should be done with options.. */
  verify_all_options();

  if( g.argc < 4 ){
    usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY");
  }
  db_open_config(0);
  if( -1 != file_size(g.argv[3]) ){
    fossil_fatal("file already exists: %s", g.argv[3]);
  }

  url_parse(g.argv[2], urlFlags);
  if( zDefaultUser==0 && g.url.user!=0 ) zDefaultUser = g.url.user;
  if( g.url.isFile ){
    file_copy(g.url.name, g.argv[3]);
Changes to src/db.c.
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
  /* We should be done with options.. */
  verify_all_options();

  if( g.argc!=3 ){
    usage("REPOSITORY-NAME");
  }
 
  if (0 == stat(g.argv[2], &sb)) {
       fossil_fatal("[%s]: %s", g.argv[2], "File already exists.");
  }

  db_create_repository(g.argv[2]);
  db_open_repository(g.argv[2]);
  db_open_config(0);
  if( zTemplate ) db_attach(zTemplate, "settingSrc");
  db_begin_transaction();







|
|







1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
  /* We should be done with options.. */
  verify_all_options();

  if( g.argc!=3 ){
    usage("REPOSITORY-NAME");
  }
 
  if( -1 != file_size(g.argv[2]) ){
    fossil_fatal("file already exists: %s", g.argv[2]);
  }

  db_create_repository(g.argv[2]);
  db_open_repository(g.argv[2]);
  db_open_config(0);
  if( zTemplate ) db_attach(zTemplate, "settingSrc");
  db_begin_transaction();