Fossil

Check-in [844718abbf]
Login

Check-in [844718abbf]

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

Overview
Comment:Make attempts to add _FOSSIL_, manifest, and manifest.uuid warnings, not fatal errors. This allows users to say things like "fossil add *" when initially populating a new project repository.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 844718abbfb4b49f05986501161a90d4a530d1a7
User & Date: drh 2008-05-13 13:20:27.000
Context
2008-05-14
02:03
Change the spelling of "descendant" to use the -ant suffix everywhere, including in the filename "descendant.c". The adjective form can be spelled either -ant or -ent, but the noun form requires -ant, or so says American Heritage. ... (check-in: 6458f020fc user: drh tags: trunk)
2008-05-13
13:20
Make attempts to add _FOSSIL_, manifest, and manifest.uuid warnings, not fatal errors. This allows users to say things like "fossil add *" when initially populating a new project repository. ... (check-in: 844718abbf user: drh tags: trunk)
00:19
Use the SCRIPT_NAME environment variable rather than REQUEST_URI to find the base name of the CGI script. ... (check-in: c23469468b user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/add.c.
60
61
62
63
64
65
66
67



68
69
70
71
72
73
74
75
76
77
78

79
80
81
82
83
84
85
      fossil_fatal("not found: %s", zName);
    }
    if( isDir==2 && access(zName, R_OK) ){
      fossil_fatal("cannot open %s", zName);
    }
    file_tree_name(zName, &pathname);
    zPath = blob_str(&pathname);
    if( strcmp(zPath, "manifest")==0 || strcmp(zPath, "_FOSSIL_")==0 ){



      fossil_fatal("cannot add %s", zPath);
    }
    if( !file_is_simple_pathname(zPath) ){
      fossil_fatal("filename contains illegal characters: %s", zPath);
    }
    if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){
      db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath);
    }else{
      db_multi_exec(
        "INSERT INTO vfile(vid,deleted,rid,mrid,pathname)"
        "VALUES(%d,0,0,0,%Q)", vid, zPath);

    }
    blob_reset(&pathname);
    free(zName);
  }
  db_end_transaction(0);
}








|
>
>
>
|
|
|
|
|
|
|
|
|
|
|
>







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
      fossil_fatal("not found: %s", zName);
    }
    if( isDir==2 && access(zName, R_OK) ){
      fossil_fatal("cannot open %s", zName);
    }
    file_tree_name(zName, &pathname);
    zPath = blob_str(&pathname);
    if( strcmp(zPath, "manifest")==0
     || strcmp(zPath, "_FOSSIL_")==0
     || strcmp(zPath, "manifest.uuid")==0
    ){
      fossil_warning("cannot add %s", zPath);
    }else{
      if( !file_is_simple_pathname(zPath) ){
        fossil_fatal("filename contains illegal characters: %s", zPath);
      }
      if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){
        db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath);
      }else{
        db_multi_exec(
          "INSERT INTO vfile(vid,deleted,rid,mrid,pathname)"
          "VALUES(%d,0,0,0,%Q)", vid, zPath);
      }
    }
    blob_reset(&pathname);
    free(zName);
  }
  db_end_transaction(0);
}

Changes to src/main.c.
248
249
250
251
252
253
254












255
256
257
258
259
260
261
    style_footer();
    cgi_reply();
  }else{
    fprintf(stderr, "%s: %s\n", g.argv[0], z);
  }
  db_force_rollback();
  exit(1);












}

/*
** Print a usage comment and quit
*/
void usage(const char *zFormat){
  fprintf(stderr, "Usage: %s %s %s\n", g.argv[0], g.argv[1], zFormat);







>
>
>
>
>
>
>
>
>
>
>
>







248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
    style_footer();
    cgi_reply();
  }else{
    fprintf(stderr, "%s: %s\n", g.argv[0], z);
  }
  db_force_rollback();
  exit(1);
}
void fossil_warning(const char *zFormat, ...){
  char *z;
  va_list ap;
  va_start(ap, zFormat);
  z = vmprintf(zFormat, ap);
  va_end(ap);
  if( g.cgiPanic ){
    cgi_printf("<p><font color=\"red\">%h</font></p>", z);
  }else{
    fprintf(stderr, "%s: %s\n", g.argv[0], z);
  }
}

/*
** Print a usage comment and quit
*/
void usage(const char *zFormat){
  fprintf(stderr, "Usage: %s %s %s\n", g.argv[0], g.argv[1], zFormat);