Fossil

Check-in [d252cfd6]
Login

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

Overview
Comment:Fix the "add" command so that it prints "SKIP" instead of "ADDED" for files that are already under management. Code to do this was already in place, but it did not work correctly due to a logic error.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d252cfd66d3c8f713c7f180def23931c67195539
User & Date: drh 2015-12-14 23:13:04
Context
2015-12-15
14:46
Add the --page option to the "fossil ui" command. check-in: f55f64e2 user: drh tags: trunk
2015-12-14
23:13
Fix the "add" command so that it prints "SKIP" instead of "ADDED" for files that are already under management. Code to do this was already in place, but it did not work correctly due to a logic error. check-in: d252cfd6 user: drh tags: trunk
2015-12-13
03:13
Fix one error and add an additional note to the article on the annotate algorithm. check-in: 9828493c user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/add.c.

166
167
168
169
170
171
172

173
174
175
176
177
178
179
180
  if( !file_is_simple_pathname(zPath, 1) ){
    fossil_warning("filename contains illegal characters: %s", zPath);
    return 0;
  }
  if( db_exists("SELECT 1 FROM vfile"
                " WHERE pathname=%Q %s", zPath, filename_collation()) ){
    db_multi_exec("UPDATE vfile SET deleted=0"

                  " WHERE pathname=%Q %s", zPath, filename_collation());
  }else{
    char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath);
    int isExe = file_wd_isexe(zFullname);
    db_multi_exec(
      "INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe,islink)"
      "VALUES(%d,0,0,0,%Q,%d,%d)",
      vid, zPath, isExe, file_wd_islink(0));







>
|







166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
  if( !file_is_simple_pathname(zPath, 1) ){
    fossil_warning("filename contains illegal characters: %s", zPath);
    return 0;
  }
  if( db_exists("SELECT 1 FROM vfile"
                " WHERE pathname=%Q %s", zPath, filename_collation()) ){
    db_multi_exec("UPDATE vfile SET deleted=0"
                  " WHERE pathname=%Q %s AND deleted",
                  zPath, filename_collation());
  }else{
    char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath);
    int isExe = file_wd_isexe(zFullname);
    db_multi_exec(
      "INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe,islink)"
      "VALUES(%d,0,0,0,%Q,%d,%d)",
      vid, zPath, isExe, file_wd_islink(0));