Fossil SCM
Enhance file_tree_name() to be capable of producing absolute paths within the local tree. Fix --hard option to mv/rm to enable it to work properly with relative paths.
Commit
c2df31dae8ad1b0edef7d7f329c8e5608484da2a
Parent
d10b1e022af373b…
10 files changed
+10
-10
+5
-5
+1
-1
+2
-2
+32
-10
+4
-4
+1
-1
+1
-1
+1
-1
+2
-2
+10
-10
| --- src/add.c | ||
| +++ src/add.c | ||
| @@ -91,11 +91,11 @@ | ||
| 91 | 91 | |
| 92 | 92 | if( cachedManifest == -1 ){ |
| 93 | 93 | Blob repo; |
| 94 | 94 | cachedManifest = db_get_boolean("manifest",0); |
| 95 | 95 | blob_zero(&repo); |
| 96 | - if( file_tree_name(g.zRepositoryName, &repo, 0) ){ | |
| 96 | + if( file_tree_name(g.zRepositoryName, &repo, 0, 0) ){ | |
| 97 | 97 | const char *zRepo = blob_str(&repo); |
| 98 | 98 | azRepo[0] = zRepo; |
| 99 | 99 | azRepo[1] = mprintf("%s-journal", zRepo); |
| 100 | 100 | azRepo[2] = mprintf("%s-wal", zRepo); |
| 101 | 101 | azRepo[3] = mprintf("%s-shm", zRepo); |
| @@ -201,11 +201,11 @@ | ||
| 201 | 201 | const char *zReserved; /* Name of a reserved file */ |
| 202 | 202 | Blob repoName; /* Treename of the repository */ |
| 203 | 203 | Stmt loop; /* SQL to loop over all files to add */ |
| 204 | 204 | int (*xCmp)(const char*,const char*); |
| 205 | 205 | |
| 206 | - if( !file_tree_name(g.zRepositoryName, &repoName, 0) ){ | |
| 206 | + if( !file_tree_name(g.zRepositoryName, &repoName, 0, 0) ){ | |
| 207 | 207 | blob_zero(&repoName); |
| 208 | 208 | zRepo = ""; |
| 209 | 209 | }else{ |
| 210 | 210 | zRepo = blob_str(&repoName); |
| 211 | 211 | } |
| @@ -307,11 +307,11 @@ | ||
| 307 | 307 | int isDir; |
| 308 | 308 | Blob fullName; |
| 309 | 309 | |
| 310 | 310 | /* file_tree_name() throws a fatal error if g.argv[i] is outside of the |
| 311 | 311 | ** checkout. */ |
| 312 | - file_tree_name(g.argv[i], &fullName, 1); | |
| 312 | + file_tree_name(g.argv[i], &fullName, 0, 1); | |
| 313 | 313 | blob_reset(&fullName); |
| 314 | 314 | |
| 315 | 315 | file_canonical_name(g.argv[i], &fullName, 0); |
| 316 | 316 | zName = blob_str(&fullName); |
| 317 | 317 | isDir = file_wd_isdir(zName); |
| @@ -365,11 +365,11 @@ | ||
| 365 | 365 | if( !tableCreated ){ |
| 366 | 366 | db_multi_exec("CREATE TEMP TABLE fremove(x TEXT PRIMARY KEY %s)", |
| 367 | 367 | filename_collation()); |
| 368 | 368 | tableCreated = 1; |
| 369 | 369 | } |
| 370 | - file_canonical_name(zOldName, &fullOldName, 0); | |
| 370 | + file_tree_name(zOldName, &fullOldName, 1, 1); | |
| 371 | 371 | db_multi_exec("INSERT INTO fremove VALUES('%q');", blob_str(&fullOldName)); |
| 372 | 372 | blob_reset(&fullOldName); |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | /* |
| @@ -464,11 +464,11 @@ | ||
| 464 | 464 | filename_collation()); |
| 465 | 465 | for(i=2; i<g.argc; i++){ |
| 466 | 466 | Blob treeName; |
| 467 | 467 | char *zTreeName; |
| 468 | 468 | |
| 469 | - file_tree_name(g.argv[i], &treeName, 1); | |
| 469 | + file_tree_name(g.argv[i], &treeName, 0, 1); | |
| 470 | 470 | zTreeName = blob_str(&treeName); |
| 471 | 471 | db_multi_exec( |
| 472 | 472 | "INSERT OR IGNORE INTO sfile" |
| 473 | 473 | " SELECT pathname FROM vfile" |
| 474 | 474 | " WHERE (pathname=%Q %s" |
| @@ -746,12 +746,12 @@ | ||
| 746 | 746 | if( !tableCreated ){ |
| 747 | 747 | db_multi_exec("CREATE TEMP TABLE fmove(x TEXT PRIMARY KEY %s, y TEXT %s)", |
| 748 | 748 | filename_collation(), filename_collation()); |
| 749 | 749 | tableCreated = 1; |
| 750 | 750 | } |
| 751 | - file_canonical_name(zOldName, &fullOldName, 0); | |
| 752 | - file_canonical_name(zNewName, &fullNewName, 0); | |
| 751 | + file_tree_name(zOldName, &fullOldName, 1, 1); | |
| 752 | + file_tree_name(zNewName, &fullNewName, 1, 1); | |
| 753 | 753 | db_multi_exec("INSERT INTO fmove VALUES('%q','%q');", |
| 754 | 754 | blob_str(&fullOldName), blob_str(&fullNewName)); |
| 755 | 755 | blob_reset(&fullNewName); |
| 756 | 756 | blob_reset(&fullOldName); |
| 757 | 757 | } |
| @@ -860,11 +860,11 @@ | ||
| 860 | 860 | moveFiles = db_get_boolean("mv-rm-files",0); |
| 861 | 861 | #else |
| 862 | 862 | moveFiles = FOSSIL_MV_RM_FILE; |
| 863 | 863 | #endif |
| 864 | 864 | } |
| 865 | - file_tree_name(zDest, &dest, 1); | |
| 865 | + file_tree_name(zDest, &dest, 0, 1); | |
| 866 | 866 | db_multi_exec( |
| 867 | 867 | "UPDATE vfile SET origname=pathname WHERE origname IS NULL;" |
| 868 | 868 | ); |
| 869 | 869 | db_multi_exec( |
| 870 | 870 | "CREATE TEMP TABLE mv(f TEXT UNIQUE ON CONFLICT IGNORE, t TEXT);" |
| @@ -872,11 +872,11 @@ | ||
| 872 | 872 | if( file_wd_isdir(zDest)!=1 ){ |
| 873 | 873 | Blob orig; |
| 874 | 874 | if( g.argc!=4 ){ |
| 875 | 875 | usage("OLDNAME NEWNAME"); |
| 876 | 876 | } |
| 877 | - file_tree_name(g.argv[2], &orig, 1); | |
| 877 | + file_tree_name(g.argv[2], &orig, 0, 1); | |
| 878 | 878 | db_multi_exec( |
| 879 | 879 | "INSERT INTO mv VALUES(%B,%B)", &orig, &dest |
| 880 | 880 | ); |
| 881 | 881 | }else{ |
| 882 | 882 | if( blob_eq(&dest, ".") ){ |
| @@ -886,11 +886,11 @@ | ||
| 886 | 886 | } |
| 887 | 887 | for(i=2; i<g.argc-1; i++){ |
| 888 | 888 | Blob orig; |
| 889 | 889 | char *zOrig; |
| 890 | 890 | int nOrig; |
| 891 | - file_tree_name(g.argv[i], &orig, 1); | |
| 891 | + file_tree_name(g.argv[i], &orig, 0, 1); | |
| 892 | 892 | zOrig = blob_str(&orig); |
| 893 | 893 | nOrig = blob_size(&orig); |
| 894 | 894 | db_prepare(&q, |
| 895 | 895 | "SELECT pathname FROM vfile" |
| 896 | 896 | " WHERE vid=%d" |
| 897 | 897 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -91,11 +91,11 @@ | |
| 91 | |
| 92 | if( cachedManifest == -1 ){ |
| 93 | Blob repo; |
| 94 | cachedManifest = db_get_boolean("manifest",0); |
| 95 | blob_zero(&repo); |
| 96 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 97 | const char *zRepo = blob_str(&repo); |
| 98 | azRepo[0] = zRepo; |
| 99 | azRepo[1] = mprintf("%s-journal", zRepo); |
| 100 | azRepo[2] = mprintf("%s-wal", zRepo); |
| 101 | azRepo[3] = mprintf("%s-shm", zRepo); |
| @@ -201,11 +201,11 @@ | |
| 201 | const char *zReserved; /* Name of a reserved file */ |
| 202 | Blob repoName; /* Treename of the repository */ |
| 203 | Stmt loop; /* SQL to loop over all files to add */ |
| 204 | int (*xCmp)(const char*,const char*); |
| 205 | |
| 206 | if( !file_tree_name(g.zRepositoryName, &repoName, 0) ){ |
| 207 | blob_zero(&repoName); |
| 208 | zRepo = ""; |
| 209 | }else{ |
| 210 | zRepo = blob_str(&repoName); |
| 211 | } |
| @@ -307,11 +307,11 @@ | |
| 307 | int isDir; |
| 308 | Blob fullName; |
| 309 | |
| 310 | /* file_tree_name() throws a fatal error if g.argv[i] is outside of the |
| 311 | ** checkout. */ |
| 312 | file_tree_name(g.argv[i], &fullName, 1); |
| 313 | blob_reset(&fullName); |
| 314 | |
| 315 | file_canonical_name(g.argv[i], &fullName, 0); |
| 316 | zName = blob_str(&fullName); |
| 317 | isDir = file_wd_isdir(zName); |
| @@ -365,11 +365,11 @@ | |
| 365 | if( !tableCreated ){ |
| 366 | db_multi_exec("CREATE TEMP TABLE fremove(x TEXT PRIMARY KEY %s)", |
| 367 | filename_collation()); |
| 368 | tableCreated = 1; |
| 369 | } |
| 370 | file_canonical_name(zOldName, &fullOldName, 0); |
| 371 | db_multi_exec("INSERT INTO fremove VALUES('%q');", blob_str(&fullOldName)); |
| 372 | blob_reset(&fullOldName); |
| 373 | } |
| 374 | |
| 375 | /* |
| @@ -464,11 +464,11 @@ | |
| 464 | filename_collation()); |
| 465 | for(i=2; i<g.argc; i++){ |
| 466 | Blob treeName; |
| 467 | char *zTreeName; |
| 468 | |
| 469 | file_tree_name(g.argv[i], &treeName, 1); |
| 470 | zTreeName = blob_str(&treeName); |
| 471 | db_multi_exec( |
| 472 | "INSERT OR IGNORE INTO sfile" |
| 473 | " SELECT pathname FROM vfile" |
| 474 | " WHERE (pathname=%Q %s" |
| @@ -746,12 +746,12 @@ | |
| 746 | if( !tableCreated ){ |
| 747 | db_multi_exec("CREATE TEMP TABLE fmove(x TEXT PRIMARY KEY %s, y TEXT %s)", |
| 748 | filename_collation(), filename_collation()); |
| 749 | tableCreated = 1; |
| 750 | } |
| 751 | file_canonical_name(zOldName, &fullOldName, 0); |
| 752 | file_canonical_name(zNewName, &fullNewName, 0); |
| 753 | db_multi_exec("INSERT INTO fmove VALUES('%q','%q');", |
| 754 | blob_str(&fullOldName), blob_str(&fullNewName)); |
| 755 | blob_reset(&fullNewName); |
| 756 | blob_reset(&fullOldName); |
| 757 | } |
| @@ -860,11 +860,11 @@ | |
| 860 | moveFiles = db_get_boolean("mv-rm-files",0); |
| 861 | #else |
| 862 | moveFiles = FOSSIL_MV_RM_FILE; |
| 863 | #endif |
| 864 | } |
| 865 | file_tree_name(zDest, &dest, 1); |
| 866 | db_multi_exec( |
| 867 | "UPDATE vfile SET origname=pathname WHERE origname IS NULL;" |
| 868 | ); |
| 869 | db_multi_exec( |
| 870 | "CREATE TEMP TABLE mv(f TEXT UNIQUE ON CONFLICT IGNORE, t TEXT);" |
| @@ -872,11 +872,11 @@ | |
| 872 | if( file_wd_isdir(zDest)!=1 ){ |
| 873 | Blob orig; |
| 874 | if( g.argc!=4 ){ |
| 875 | usage("OLDNAME NEWNAME"); |
| 876 | } |
| 877 | file_tree_name(g.argv[2], &orig, 1); |
| 878 | db_multi_exec( |
| 879 | "INSERT INTO mv VALUES(%B,%B)", &orig, &dest |
| 880 | ); |
| 881 | }else{ |
| 882 | if( blob_eq(&dest, ".") ){ |
| @@ -886,11 +886,11 @@ | |
| 886 | } |
| 887 | for(i=2; i<g.argc-1; i++){ |
| 888 | Blob orig; |
| 889 | char *zOrig; |
| 890 | int nOrig; |
| 891 | file_tree_name(g.argv[i], &orig, 1); |
| 892 | zOrig = blob_str(&orig); |
| 893 | nOrig = blob_size(&orig); |
| 894 | db_prepare(&q, |
| 895 | "SELECT pathname FROM vfile" |
| 896 | " WHERE vid=%d" |
| 897 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -91,11 +91,11 @@ | |
| 91 | |
| 92 | if( cachedManifest == -1 ){ |
| 93 | Blob repo; |
| 94 | cachedManifest = db_get_boolean("manifest",0); |
| 95 | blob_zero(&repo); |
| 96 | if( file_tree_name(g.zRepositoryName, &repo, 0, 0) ){ |
| 97 | const char *zRepo = blob_str(&repo); |
| 98 | azRepo[0] = zRepo; |
| 99 | azRepo[1] = mprintf("%s-journal", zRepo); |
| 100 | azRepo[2] = mprintf("%s-wal", zRepo); |
| 101 | azRepo[3] = mprintf("%s-shm", zRepo); |
| @@ -201,11 +201,11 @@ | |
| 201 | const char *zReserved; /* Name of a reserved file */ |
| 202 | Blob repoName; /* Treename of the repository */ |
| 203 | Stmt loop; /* SQL to loop over all files to add */ |
| 204 | int (*xCmp)(const char*,const char*); |
| 205 | |
| 206 | if( !file_tree_name(g.zRepositoryName, &repoName, 0, 0) ){ |
| 207 | blob_zero(&repoName); |
| 208 | zRepo = ""; |
| 209 | }else{ |
| 210 | zRepo = blob_str(&repoName); |
| 211 | } |
| @@ -307,11 +307,11 @@ | |
| 307 | int isDir; |
| 308 | Blob fullName; |
| 309 | |
| 310 | /* file_tree_name() throws a fatal error if g.argv[i] is outside of the |
| 311 | ** checkout. */ |
| 312 | file_tree_name(g.argv[i], &fullName, 0, 1); |
| 313 | blob_reset(&fullName); |
| 314 | |
| 315 | file_canonical_name(g.argv[i], &fullName, 0); |
| 316 | zName = blob_str(&fullName); |
| 317 | isDir = file_wd_isdir(zName); |
| @@ -365,11 +365,11 @@ | |
| 365 | if( !tableCreated ){ |
| 366 | db_multi_exec("CREATE TEMP TABLE fremove(x TEXT PRIMARY KEY %s)", |
| 367 | filename_collation()); |
| 368 | tableCreated = 1; |
| 369 | } |
| 370 | file_tree_name(zOldName, &fullOldName, 1, 1); |
| 371 | db_multi_exec("INSERT INTO fremove VALUES('%q');", blob_str(&fullOldName)); |
| 372 | blob_reset(&fullOldName); |
| 373 | } |
| 374 | |
| 375 | /* |
| @@ -464,11 +464,11 @@ | |
| 464 | filename_collation()); |
| 465 | for(i=2; i<g.argc; i++){ |
| 466 | Blob treeName; |
| 467 | char *zTreeName; |
| 468 | |
| 469 | file_tree_name(g.argv[i], &treeName, 0, 1); |
| 470 | zTreeName = blob_str(&treeName); |
| 471 | db_multi_exec( |
| 472 | "INSERT OR IGNORE INTO sfile" |
| 473 | " SELECT pathname FROM vfile" |
| 474 | " WHERE (pathname=%Q %s" |
| @@ -746,12 +746,12 @@ | |
| 746 | if( !tableCreated ){ |
| 747 | db_multi_exec("CREATE TEMP TABLE fmove(x TEXT PRIMARY KEY %s, y TEXT %s)", |
| 748 | filename_collation(), filename_collation()); |
| 749 | tableCreated = 1; |
| 750 | } |
| 751 | file_tree_name(zOldName, &fullOldName, 1, 1); |
| 752 | file_tree_name(zNewName, &fullNewName, 1, 1); |
| 753 | db_multi_exec("INSERT INTO fmove VALUES('%q','%q');", |
| 754 | blob_str(&fullOldName), blob_str(&fullNewName)); |
| 755 | blob_reset(&fullNewName); |
| 756 | blob_reset(&fullOldName); |
| 757 | } |
| @@ -860,11 +860,11 @@ | |
| 860 | moveFiles = db_get_boolean("mv-rm-files",0); |
| 861 | #else |
| 862 | moveFiles = FOSSIL_MV_RM_FILE; |
| 863 | #endif |
| 864 | } |
| 865 | file_tree_name(zDest, &dest, 0, 1); |
| 866 | db_multi_exec( |
| 867 | "UPDATE vfile SET origname=pathname WHERE origname IS NULL;" |
| 868 | ); |
| 869 | db_multi_exec( |
| 870 | "CREATE TEMP TABLE mv(f TEXT UNIQUE ON CONFLICT IGNORE, t TEXT);" |
| @@ -872,11 +872,11 @@ | |
| 872 | if( file_wd_isdir(zDest)!=1 ){ |
| 873 | Blob orig; |
| 874 | if( g.argc!=4 ){ |
| 875 | usage("OLDNAME NEWNAME"); |
| 876 | } |
| 877 | file_tree_name(g.argv[2], &orig, 0, 1); |
| 878 | db_multi_exec( |
| 879 | "INSERT INTO mv VALUES(%B,%B)", &orig, &dest |
| 880 | ); |
| 881 | }else{ |
| 882 | if( blob_eq(&dest, ".") ){ |
| @@ -886,11 +886,11 @@ | |
| 886 | } |
| 887 | for(i=2; i<g.argc-1; i++){ |
| 888 | Blob orig; |
| 889 | char *zOrig; |
| 890 | int nOrig; |
| 891 | file_tree_name(g.argv[i], &orig, 0, 1); |
| 892 | zOrig = blob_str(&orig); |
| 893 | nOrig = blob_size(&orig); |
| 894 | db_prepare(&q, |
| 895 | "SELECT pathname FROM vfile" |
| 896 | " WHERE vid=%d" |
| 897 |
+5
-5
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -46,11 +46,11 @@ | ||
| 46 | 46 | int i; |
| 47 | 47 | |
| 48 | 48 | blob_zero(&where); |
| 49 | 49 | for(i=2; i<g.argc; i++){ |
| 50 | 50 | Blob fname; |
| 51 | - file_tree_name(g.argv[i], &fname, 1); | |
| 51 | + file_tree_name(g.argv[i], &fname, 0, 1); | |
| 52 | 52 | zName = blob_str(&fname); |
| 53 | 53 | if( fossil_strcmp(zName, ".")==0 ){ |
| 54 | 54 | blob_reset(&where); |
| 55 | 55 | break; |
| 56 | 56 | } |
| @@ -296,11 +296,11 @@ | ||
| 296 | 296 | |
| 297 | 297 | /* Handle given file names */ |
| 298 | 298 | blob_zero(&where); |
| 299 | 299 | for(i=2; i<g.argc; i++){ |
| 300 | 300 | Blob fname; |
| 301 | - file_tree_name(g.argv[i], &fname, 1); | |
| 301 | + file_tree_name(g.argv[i], &fname, 0, 1); | |
| 302 | 302 | zName = blob_str(&fname); |
| 303 | 303 | if( fossil_strcmp(zName, ".")==0 ){ |
| 304 | 304 | blob_reset(&where); |
| 305 | 305 | break; |
| 306 | 306 | } |
| @@ -409,11 +409,11 @@ | ||
| 409 | 409 | } |
| 410 | 410 | verify_all_options(); |
| 411 | 411 | blob_zero(&where); |
| 412 | 412 | for(i=2; i<g.argc; i++){ |
| 413 | 413 | Blob fname; |
| 414 | - file_tree_name(g.argv[i], &fname, 1); | |
| 414 | + file_tree_name(g.argv[i], &fname, 0, 1); | |
| 415 | 415 | zName = blob_str(&fname); |
| 416 | 416 | if( fossil_strcmp(zName, ".")==0 ){ |
| 417 | 417 | blob_reset(&where); |
| 418 | 418 | break; |
| 419 | 419 | } |
| @@ -741,11 +741,11 @@ | ||
| 741 | 741 | "SELECT %Q || x FROM sfile" |
| 742 | 742 | " WHERE x NOT IN (%s)" |
| 743 | 743 | " ORDER BY 1", |
| 744 | 744 | g.zLocalRoot, fossil_all_reserved_names(0) |
| 745 | 745 | ); |
| 746 | - if( file_tree_name(g.zRepositoryName, &repo, 0) ){ | |
| 746 | + if( file_tree_name(g.zRepositoryName, &repo, 0, 0) ){ | |
| 747 | 747 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 748 | 748 | } |
| 749 | 749 | db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)"); |
| 750 | 750 | while( db_step(&q)==SQLITE_ROW ){ |
| 751 | 751 | const char *zName = db_column_text(&q, 0); |
| @@ -1037,11 +1037,11 @@ | ||
| 1037 | 1037 | |
| 1038 | 1038 | blob_zero(&fname); |
| 1039 | 1039 | bag_init(&toCommit); |
| 1040 | 1040 | for(ii=2; ii<g.argc; ii++){ |
| 1041 | 1041 | int cnt = 0; |
| 1042 | - file_tree_name(g.argv[ii], &fname, 1); | |
| 1042 | + file_tree_name(g.argv[ii], &fname, 0, 1); | |
| 1043 | 1043 | if( fossil_strcmp(blob_str(&fname),".")==0 ){ |
| 1044 | 1044 | bag_clear(&toCommit); |
| 1045 | 1045 | return result; |
| 1046 | 1046 | } |
| 1047 | 1047 | db_prepare(&q, |
| 1048 | 1048 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -46,11 +46,11 @@ | |
| 46 | int i; |
| 47 | |
| 48 | blob_zero(&where); |
| 49 | for(i=2; i<g.argc; i++){ |
| 50 | Blob fname; |
| 51 | file_tree_name(g.argv[i], &fname, 1); |
| 52 | zName = blob_str(&fname); |
| 53 | if( fossil_strcmp(zName, ".")==0 ){ |
| 54 | blob_reset(&where); |
| 55 | break; |
| 56 | } |
| @@ -296,11 +296,11 @@ | |
| 296 | |
| 297 | /* Handle given file names */ |
| 298 | blob_zero(&where); |
| 299 | for(i=2; i<g.argc; i++){ |
| 300 | Blob fname; |
| 301 | file_tree_name(g.argv[i], &fname, 1); |
| 302 | zName = blob_str(&fname); |
| 303 | if( fossil_strcmp(zName, ".")==0 ){ |
| 304 | blob_reset(&where); |
| 305 | break; |
| 306 | } |
| @@ -409,11 +409,11 @@ | |
| 409 | } |
| 410 | verify_all_options(); |
| 411 | blob_zero(&where); |
| 412 | for(i=2; i<g.argc; i++){ |
| 413 | Blob fname; |
| 414 | file_tree_name(g.argv[i], &fname, 1); |
| 415 | zName = blob_str(&fname); |
| 416 | if( fossil_strcmp(zName, ".")==0 ){ |
| 417 | blob_reset(&where); |
| 418 | break; |
| 419 | } |
| @@ -741,11 +741,11 @@ | |
| 741 | "SELECT %Q || x FROM sfile" |
| 742 | " WHERE x NOT IN (%s)" |
| 743 | " ORDER BY 1", |
| 744 | g.zLocalRoot, fossil_all_reserved_names(0) |
| 745 | ); |
| 746 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 747 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 748 | } |
| 749 | db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)"); |
| 750 | while( db_step(&q)==SQLITE_ROW ){ |
| 751 | const char *zName = db_column_text(&q, 0); |
| @@ -1037,11 +1037,11 @@ | |
| 1037 | |
| 1038 | blob_zero(&fname); |
| 1039 | bag_init(&toCommit); |
| 1040 | for(ii=2; ii<g.argc; ii++){ |
| 1041 | int cnt = 0; |
| 1042 | file_tree_name(g.argv[ii], &fname, 1); |
| 1043 | if( fossil_strcmp(blob_str(&fname),".")==0 ){ |
| 1044 | bag_clear(&toCommit); |
| 1045 | return result; |
| 1046 | } |
| 1047 | db_prepare(&q, |
| 1048 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -46,11 +46,11 @@ | |
| 46 | int i; |
| 47 | |
| 48 | blob_zero(&where); |
| 49 | for(i=2; i<g.argc; i++){ |
| 50 | Blob fname; |
| 51 | file_tree_name(g.argv[i], &fname, 0, 1); |
| 52 | zName = blob_str(&fname); |
| 53 | if( fossil_strcmp(zName, ".")==0 ){ |
| 54 | blob_reset(&where); |
| 55 | break; |
| 56 | } |
| @@ -296,11 +296,11 @@ | |
| 296 | |
| 297 | /* Handle given file names */ |
| 298 | blob_zero(&where); |
| 299 | for(i=2; i<g.argc; i++){ |
| 300 | Blob fname; |
| 301 | file_tree_name(g.argv[i], &fname, 0, 1); |
| 302 | zName = blob_str(&fname); |
| 303 | if( fossil_strcmp(zName, ".")==0 ){ |
| 304 | blob_reset(&where); |
| 305 | break; |
| 306 | } |
| @@ -409,11 +409,11 @@ | |
| 409 | } |
| 410 | verify_all_options(); |
| 411 | blob_zero(&where); |
| 412 | for(i=2; i<g.argc; i++){ |
| 413 | Blob fname; |
| 414 | file_tree_name(g.argv[i], &fname, 0, 1); |
| 415 | zName = blob_str(&fname); |
| 416 | if( fossil_strcmp(zName, ".")==0 ){ |
| 417 | blob_reset(&where); |
| 418 | break; |
| 419 | } |
| @@ -741,11 +741,11 @@ | |
| 741 | "SELECT %Q || x FROM sfile" |
| 742 | " WHERE x NOT IN (%s)" |
| 743 | " ORDER BY 1", |
| 744 | g.zLocalRoot, fossil_all_reserved_names(0) |
| 745 | ); |
| 746 | if( file_tree_name(g.zRepositoryName, &repo, 0, 0) ){ |
| 747 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 748 | } |
| 749 | db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)"); |
| 750 | while( db_step(&q)==SQLITE_ROW ){ |
| 751 | const char *zName = db_column_text(&q, 0); |
| @@ -1037,11 +1037,11 @@ | |
| 1037 | |
| 1038 | blob_zero(&fname); |
| 1039 | bag_init(&toCommit); |
| 1040 | for(ii=2; ii<g.argc; ii++){ |
| 1041 | int cnt = 0; |
| 1042 | file_tree_name(g.argv[ii], &fname, 0, 1); |
| 1043 | if( fossil_strcmp(blob_str(&fname),".")==0 ){ |
| 1044 | bag_clear(&toCommit); |
| 1045 | return result; |
| 1046 | } |
| 1047 | db_prepare(&q, |
| 1048 |
+1
-1
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -2457,11 +2457,11 @@ | ||
| 2457 | 2457 | verify_all_options(); |
| 2458 | 2458 | |
| 2459 | 2459 | if( g.argc<3 ) { |
| 2460 | 2460 | usage("FILENAME"); |
| 2461 | 2461 | } |
| 2462 | - file_tree_name(g.argv[2], &treename, 1); | |
| 2462 | + file_tree_name(g.argv[2], &treename, 0, 1); | |
| 2463 | 2463 | zFilename = blob_str(&treename); |
| 2464 | 2464 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); |
| 2465 | 2465 | if( fnid==0 ){ |
| 2466 | 2466 | fossil_fatal("no such file: %s", zFilename); |
| 2467 | 2467 | } |
| 2468 | 2468 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -2457,11 +2457,11 @@ | |
| 2457 | verify_all_options(); |
| 2458 | |
| 2459 | if( g.argc<3 ) { |
| 2460 | usage("FILENAME"); |
| 2461 | } |
| 2462 | file_tree_name(g.argv[2], &treename, 1); |
| 2463 | zFilename = blob_str(&treename); |
| 2464 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); |
| 2465 | if( fnid==0 ){ |
| 2466 | fossil_fatal("no such file: %s", zFilename); |
| 2467 | } |
| 2468 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -2457,11 +2457,11 @@ | |
| 2457 | verify_all_options(); |
| 2458 | |
| 2459 | if( g.argc<3 ) { |
| 2460 | usage("FILENAME"); |
| 2461 | } |
| 2462 | file_tree_name(g.argv[2], &treename, 0, 1); |
| 2463 | zFilename = blob_str(&treename); |
| 2464 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); |
| 2465 | if( fnid==0 ){ |
| 2466 | fossil_fatal("no such file: %s", zFilename); |
| 2467 | } |
| 2468 |
+2
-2
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -298,11 +298,11 @@ | ||
| 298 | 298 | ){ |
| 299 | 299 | Blob fname; |
| 300 | 300 | Blob content; |
| 301 | 301 | int isLink; |
| 302 | 302 | int isBin; |
| 303 | - file_tree_name(zFileTreeName, &fname, 1); | |
| 303 | + file_tree_name(zFileTreeName, &fname, 0, 1); | |
| 304 | 304 | historical_version_of_file(zFrom, blob_str(&fname), &content, &isLink, 0, |
| 305 | 305 | fIncludeBinary ? 0 : &isBin, 0); |
| 306 | 306 | if( !isLink != !file_wd_islink(zFrom) ){ |
| 307 | 307 | fossil_print("%s",DIFF_CANNOT_COMPUTE_SYMLINK); |
| 308 | 308 | }else{ |
| @@ -454,11 +454,11 @@ | ||
| 454 | 454 | Blob fname; |
| 455 | 455 | Blob v1, v2; |
| 456 | 456 | int isLink1, isLink2; |
| 457 | 457 | int isBin1, isBin2; |
| 458 | 458 | if( diffFlags & DIFF_BRIEF ) return; |
| 459 | - file_tree_name(zFileTreeName, &fname, 1); | |
| 459 | + file_tree_name(zFileTreeName, &fname, 0, 1); | |
| 460 | 460 | zName = blob_str(&fname); |
| 461 | 461 | historical_version_of_file(zFrom, zName, &v1, &isLink1, 0, |
| 462 | 462 | fIncludeBinary ? 0 : &isBin1, 0); |
| 463 | 463 | historical_version_of_file(zTo, zName, &v2, &isLink2, 0, |
| 464 | 464 | fIncludeBinary ? 0 : &isBin2, 0); |
| 465 | 465 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -298,11 +298,11 @@ | |
| 298 | ){ |
| 299 | Blob fname; |
| 300 | Blob content; |
| 301 | int isLink; |
| 302 | int isBin; |
| 303 | file_tree_name(zFileTreeName, &fname, 1); |
| 304 | historical_version_of_file(zFrom, blob_str(&fname), &content, &isLink, 0, |
| 305 | fIncludeBinary ? 0 : &isBin, 0); |
| 306 | if( !isLink != !file_wd_islink(zFrom) ){ |
| 307 | fossil_print("%s",DIFF_CANNOT_COMPUTE_SYMLINK); |
| 308 | }else{ |
| @@ -454,11 +454,11 @@ | |
| 454 | Blob fname; |
| 455 | Blob v1, v2; |
| 456 | int isLink1, isLink2; |
| 457 | int isBin1, isBin2; |
| 458 | if( diffFlags & DIFF_BRIEF ) return; |
| 459 | file_tree_name(zFileTreeName, &fname, 1); |
| 460 | zName = blob_str(&fname); |
| 461 | historical_version_of_file(zFrom, zName, &v1, &isLink1, 0, |
| 462 | fIncludeBinary ? 0 : &isBin1, 0); |
| 463 | historical_version_of_file(zTo, zName, &v2, &isLink2, 0, |
| 464 | fIncludeBinary ? 0 : &isBin2, 0); |
| 465 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -298,11 +298,11 @@ | |
| 298 | ){ |
| 299 | Blob fname; |
| 300 | Blob content; |
| 301 | int isLink; |
| 302 | int isBin; |
| 303 | file_tree_name(zFileTreeName, &fname, 0, 1); |
| 304 | historical_version_of_file(zFrom, blob_str(&fname), &content, &isLink, 0, |
| 305 | fIncludeBinary ? 0 : &isBin, 0); |
| 306 | if( !isLink != !file_wd_islink(zFrom) ){ |
| 307 | fossil_print("%s",DIFF_CANNOT_COMPUTE_SYMLINK); |
| 308 | }else{ |
| @@ -454,11 +454,11 @@ | |
| 454 | Blob fname; |
| 455 | Blob v1, v2; |
| 456 | int isLink1, isLink2; |
| 457 | int isBin1, isBin2; |
| 458 | if( diffFlags & DIFF_BRIEF ) return; |
| 459 | file_tree_name(zFileTreeName, &fname, 0, 1); |
| 460 | zName = blob_str(&fname); |
| 461 | historical_version_of_file(zFrom, zName, &v1, &isLink1, 0, |
| 462 | fIncludeBinary ? 0 : &isBin1, 0); |
| 463 | historical_version_of_file(zTo, zName, &v2, &isLink2, 0, |
| 464 | fIncludeBinary ? 0 : &isBin2, 0); |
| 465 |
+32
-10
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -1029,18 +1029,25 @@ | ||
| 1029 | 1029 | blob_reset(&x); |
| 1030 | 1030 | } |
| 1031 | 1031 | } |
| 1032 | 1032 | |
| 1033 | 1033 | /* |
| 1034 | -** Compute a pathname for a file relative to the root of the local | |
| 1035 | -** tree. Return TRUE on success. On failure, print and error | |
| 1036 | -** message and quit if the errFatal flag is true. If errFatal is | |
| 1037 | -** false, then simply return 0. | |
| 1038 | -** | |
| 1039 | -** The root of the tree is defined by the g.zLocalRoot variable. | |
| 1034 | +** Compute a full path name for a file in the local tree. If | |
| 1035 | +** the absolute flag is non-zero, the computed path will be | |
| 1036 | +** absolute, starting with the root path of the local tree; | |
| 1037 | +** otherwise, it will be relative to the root of the local | |
| 1038 | +** tree. In both cases, the root of the local tree is defined | |
| 1039 | +** by the g.zLocalRoot variable. Return TRUE on success. On | |
| 1040 | +** failure, print and error message and quit if the errFatal | |
| 1041 | +** flag is true. If errFatal is false, then simply return 0. | |
| 1040 | 1042 | */ |
| 1041 | -int file_tree_name(const char *zOrigName, Blob *pOut, int errFatal){ | |
| 1043 | +int file_tree_name( | |
| 1044 | + const char *zOrigName, | |
| 1045 | + Blob *pOut, | |
| 1046 | + int absolute, | |
| 1047 | + int errFatal | |
| 1048 | +){ | |
| 1042 | 1049 | Blob localRoot; |
| 1043 | 1050 | int nLocalRoot; |
| 1044 | 1051 | char *zLocalRoot; |
| 1045 | 1052 | Blob full; |
| 1046 | 1053 | int nFull; |
| @@ -1066,11 +1073,15 @@ | ||
| 1066 | 1073 | } |
| 1067 | 1074 | |
| 1068 | 1075 | /* Special case. zOrigName refers to g.zLocalRoot directory. */ |
| 1069 | 1076 | if( (nFull==nLocalRoot-1 && xCmp(zLocalRoot, zFull, nFull)==0) |
| 1070 | 1077 | || (nFull==1 && zFull[0]=='/' && nLocalRoot==1 && zLocalRoot[0]=='/') ){ |
| 1071 | - blob_append(pOut, ".", 1); | |
| 1078 | + if( absolute ){ | |
| 1079 | + blob_append(pOut, zLocalRoot, nLocalRoot); | |
| 1080 | + }else{ | |
| 1081 | + blob_append(pOut, ".", 1); | |
| 1082 | + } | |
| 1072 | 1083 | blob_reset(&localRoot); |
| 1073 | 1084 | blob_reset(&full); |
| 1074 | 1085 | return 1; |
| 1075 | 1086 | } |
| 1076 | 1087 | |
| @@ -1080,11 +1091,20 @@ | ||
| 1080 | 1091 | if( errFatal ){ |
| 1081 | 1092 | fossil_fatal("file outside of checkout tree: %s", zOrigName); |
| 1082 | 1093 | } |
| 1083 | 1094 | return 0; |
| 1084 | 1095 | } |
| 1085 | - blob_append(pOut, &zFull[nLocalRoot], nFull-nLocalRoot); | |
| 1096 | + if( absolute ){ | |
| 1097 | + if( !file_is_absolute_path(zOrigName) ){ | |
| 1098 | + blob_append(pOut, zLocalRoot, nLocalRoot); | |
| 1099 | + } | |
| 1100 | + blob_append(pOut, zOrigName, -1); | |
| 1101 | + blob_resize(pOut, file_simplify_name(blob_buffer(pOut), | |
| 1102 | + blob_size(pOut), 0)); | |
| 1103 | + }else{ | |
| 1104 | + blob_append(pOut, &zFull[nLocalRoot], nFull-nLocalRoot); | |
| 1105 | + } | |
| 1086 | 1106 | blob_reset(&localRoot); |
| 1087 | 1107 | blob_reset(&full); |
| 1088 | 1108 | return 1; |
| 1089 | 1109 | } |
| 1090 | 1110 | |
| @@ -1092,20 +1112,22 @@ | ||
| 1092 | 1112 | ** COMMAND: test-tree-name |
| 1093 | 1113 | ** |
| 1094 | 1114 | ** Test the operation of the tree name generator. |
| 1095 | 1115 | ** |
| 1096 | 1116 | ** Options: |
| 1117 | +** --absolute Return an absolute path intead of a relative one. | |
| 1097 | 1118 | ** --case-sensitive B Enable or disable case-sensitive filenames. B is |
| 1098 | 1119 | ** a boolean: "yes", "no", "true", "false", etc. |
| 1099 | 1120 | */ |
| 1100 | 1121 | void cmd_test_tree_name(void){ |
| 1101 | 1122 | int i; |
| 1102 | 1123 | Blob x; |
| 1124 | + int absoluteFlag = find_option("absolute",0,0)!=0; | |
| 1103 | 1125 | db_find_and_open_repository(0,0); |
| 1104 | 1126 | blob_zero(&x); |
| 1105 | 1127 | for(i=2; i<g.argc; i++){ |
| 1106 | - if( file_tree_name(g.argv[i], &x, 1) ){ | |
| 1128 | + if( file_tree_name(g.argv[i], &x, absoluteFlag, 1) ){ | |
| 1107 | 1129 | fossil_print("%s\n", blob_buffer(&x)); |
| 1108 | 1130 | blob_reset(&x); |
| 1109 | 1131 | } |
| 1110 | 1132 | } |
| 1111 | 1133 | } |
| 1112 | 1134 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -1029,18 +1029,25 @@ | |
| 1029 | blob_reset(&x); |
| 1030 | } |
| 1031 | } |
| 1032 | |
| 1033 | /* |
| 1034 | ** Compute a pathname for a file relative to the root of the local |
| 1035 | ** tree. Return TRUE on success. On failure, print and error |
| 1036 | ** message and quit if the errFatal flag is true. If errFatal is |
| 1037 | ** false, then simply return 0. |
| 1038 | ** |
| 1039 | ** The root of the tree is defined by the g.zLocalRoot variable. |
| 1040 | */ |
| 1041 | int file_tree_name(const char *zOrigName, Blob *pOut, int errFatal){ |
| 1042 | Blob localRoot; |
| 1043 | int nLocalRoot; |
| 1044 | char *zLocalRoot; |
| 1045 | Blob full; |
| 1046 | int nFull; |
| @@ -1066,11 +1073,15 @@ | |
| 1066 | } |
| 1067 | |
| 1068 | /* Special case. zOrigName refers to g.zLocalRoot directory. */ |
| 1069 | if( (nFull==nLocalRoot-1 && xCmp(zLocalRoot, zFull, nFull)==0) |
| 1070 | || (nFull==1 && zFull[0]=='/' && nLocalRoot==1 && zLocalRoot[0]=='/') ){ |
| 1071 | blob_append(pOut, ".", 1); |
| 1072 | blob_reset(&localRoot); |
| 1073 | blob_reset(&full); |
| 1074 | return 1; |
| 1075 | } |
| 1076 | |
| @@ -1080,11 +1091,20 @@ | |
| 1080 | if( errFatal ){ |
| 1081 | fossil_fatal("file outside of checkout tree: %s", zOrigName); |
| 1082 | } |
| 1083 | return 0; |
| 1084 | } |
| 1085 | blob_append(pOut, &zFull[nLocalRoot], nFull-nLocalRoot); |
| 1086 | blob_reset(&localRoot); |
| 1087 | blob_reset(&full); |
| 1088 | return 1; |
| 1089 | } |
| 1090 | |
| @@ -1092,20 +1112,22 @@ | |
| 1092 | ** COMMAND: test-tree-name |
| 1093 | ** |
| 1094 | ** Test the operation of the tree name generator. |
| 1095 | ** |
| 1096 | ** Options: |
| 1097 | ** --case-sensitive B Enable or disable case-sensitive filenames. B is |
| 1098 | ** a boolean: "yes", "no", "true", "false", etc. |
| 1099 | */ |
| 1100 | void cmd_test_tree_name(void){ |
| 1101 | int i; |
| 1102 | Blob x; |
| 1103 | db_find_and_open_repository(0,0); |
| 1104 | blob_zero(&x); |
| 1105 | for(i=2; i<g.argc; i++){ |
| 1106 | if( file_tree_name(g.argv[i], &x, 1) ){ |
| 1107 | fossil_print("%s\n", blob_buffer(&x)); |
| 1108 | blob_reset(&x); |
| 1109 | } |
| 1110 | } |
| 1111 | } |
| 1112 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -1029,18 +1029,25 @@ | |
| 1029 | blob_reset(&x); |
| 1030 | } |
| 1031 | } |
| 1032 | |
| 1033 | /* |
| 1034 | ** Compute a full path name for a file in the local tree. If |
| 1035 | ** the absolute flag is non-zero, the computed path will be |
| 1036 | ** absolute, starting with the root path of the local tree; |
| 1037 | ** otherwise, it will be relative to the root of the local |
| 1038 | ** tree. In both cases, the root of the local tree is defined |
| 1039 | ** by the g.zLocalRoot variable. Return TRUE on success. On |
| 1040 | ** failure, print and error message and quit if the errFatal |
| 1041 | ** flag is true. If errFatal is false, then simply return 0. |
| 1042 | */ |
| 1043 | int file_tree_name( |
| 1044 | const char *zOrigName, |
| 1045 | Blob *pOut, |
| 1046 | int absolute, |
| 1047 | int errFatal |
| 1048 | ){ |
| 1049 | Blob localRoot; |
| 1050 | int nLocalRoot; |
| 1051 | char *zLocalRoot; |
| 1052 | Blob full; |
| 1053 | int nFull; |
| @@ -1066,11 +1073,15 @@ | |
| 1073 | } |
| 1074 | |
| 1075 | /* Special case. zOrigName refers to g.zLocalRoot directory. */ |
| 1076 | if( (nFull==nLocalRoot-1 && xCmp(zLocalRoot, zFull, nFull)==0) |
| 1077 | || (nFull==1 && zFull[0]=='/' && nLocalRoot==1 && zLocalRoot[0]=='/') ){ |
| 1078 | if( absolute ){ |
| 1079 | blob_append(pOut, zLocalRoot, nLocalRoot); |
| 1080 | }else{ |
| 1081 | blob_append(pOut, ".", 1); |
| 1082 | } |
| 1083 | blob_reset(&localRoot); |
| 1084 | blob_reset(&full); |
| 1085 | return 1; |
| 1086 | } |
| 1087 | |
| @@ -1080,11 +1091,20 @@ | |
| 1091 | if( errFatal ){ |
| 1092 | fossil_fatal("file outside of checkout tree: %s", zOrigName); |
| 1093 | } |
| 1094 | return 0; |
| 1095 | } |
| 1096 | if( absolute ){ |
| 1097 | if( !file_is_absolute_path(zOrigName) ){ |
| 1098 | blob_append(pOut, zLocalRoot, nLocalRoot); |
| 1099 | } |
| 1100 | blob_append(pOut, zOrigName, -1); |
| 1101 | blob_resize(pOut, file_simplify_name(blob_buffer(pOut), |
| 1102 | blob_size(pOut), 0)); |
| 1103 | }else{ |
| 1104 | blob_append(pOut, &zFull[nLocalRoot], nFull-nLocalRoot); |
| 1105 | } |
| 1106 | blob_reset(&localRoot); |
| 1107 | blob_reset(&full); |
| 1108 | return 1; |
| 1109 | } |
| 1110 | |
| @@ -1092,20 +1112,22 @@ | |
| 1112 | ** COMMAND: test-tree-name |
| 1113 | ** |
| 1114 | ** Test the operation of the tree name generator. |
| 1115 | ** |
| 1116 | ** Options: |
| 1117 | ** --absolute Return an absolute path intead of a relative one. |
| 1118 | ** --case-sensitive B Enable or disable case-sensitive filenames. B is |
| 1119 | ** a boolean: "yes", "no", "true", "false", etc. |
| 1120 | */ |
| 1121 | void cmd_test_tree_name(void){ |
| 1122 | int i; |
| 1123 | Blob x; |
| 1124 | int absoluteFlag = find_option("absolute",0,0)!=0; |
| 1125 | db_find_and_open_repository(0,0); |
| 1126 | blob_zero(&x); |
| 1127 | for(i=2; i<g.argc; i++){ |
| 1128 | if( file_tree_name(g.argv[i], &x, absoluteFlag, 1) ){ |
| 1129 | fossil_print("%s\n", blob_buffer(&x)); |
| 1130 | blob_reset(&x); |
| 1131 | } |
| 1132 | } |
| 1133 | } |
| 1134 |
+4
-4
| --- src/finfo.c | ||
| +++ src/finfo.c | ||
| @@ -73,11 +73,11 @@ | ||
| 73 | 73 | vid = db_lget_int("checkout", 0); |
| 74 | 74 | if( vid==0 ){ |
| 75 | 75 | fossil_fatal("no checkout to finfo files in"); |
| 76 | 76 | } |
| 77 | 77 | vfile_check_signature(vid, CKSIG_ENOTFILE); |
| 78 | - file_tree_name(g.argv[2], &fname, 1); | |
| 78 | + file_tree_name(g.argv[2], &fname, 0, 1); | |
| 79 | 79 | db_prepare(&q, |
| 80 | 80 | "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)" |
| 81 | 81 | " FROM vfile WHERE vfile.pathname=%B %s", |
| 82 | 82 | &fname, filename_collation()); |
| 83 | 83 | blob_zero(&line); |
| @@ -122,11 +122,11 @@ | ||
| 122 | 122 | const char *zRevision = find_option("revision", "r", 1); |
| 123 | 123 | |
| 124 | 124 | /* We should be done with options.. */ |
| 125 | 125 | verify_all_options(); |
| 126 | 126 | |
| 127 | - file_tree_name(g.argv[2], &fname, 1); | |
| 127 | + file_tree_name(g.argv[2], &fname, 0, 1); | |
| 128 | 128 | if( zRevision ){ |
| 129 | 129 | historical_version_of_file(zRevision, blob_str(&fname), &record, 0,0,0,0); |
| 130 | 130 | }else{ |
| 131 | 131 | int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B %s", |
| 132 | 132 | &fname, filename_collation()); |
| @@ -174,11 +174,11 @@ | ||
| 174 | 174 | verify_all_options(); |
| 175 | 175 | |
| 176 | 176 | if( g.argc!=3 ){ |
| 177 | 177 | usage("?-l|--log? ?-b|--brief? FILENAME"); |
| 178 | 178 | } |
| 179 | - file_tree_name(g.argv[2], &fname, 1); | |
| 179 | + file_tree_name(g.argv[2], &fname, 0, 1); | |
| 180 | 180 | rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B %s", |
| 181 | 181 | &fname, filename_collation()); |
| 182 | 182 | if( rid==0 ){ |
| 183 | 183 | fossil_fatal("no history for file: %b", &fname); |
| 184 | 184 | } |
| @@ -259,11 +259,11 @@ | ||
| 259 | 259 | |
| 260 | 260 | /* We should be done with options.. */ |
| 261 | 261 | verify_all_options(); |
| 262 | 262 | |
| 263 | 263 | for(i=2; i<g.argc; i++){ |
| 264 | - file_tree_name(g.argv[i], &fname, 1); | |
| 264 | + file_tree_name(g.argv[i], &fname, 0, 1); | |
| 265 | 265 | blob_zero(&content); |
| 266 | 266 | rc = historical_version_of_file(zRev, blob_str(&fname), &content, 0,0,0,2); |
| 267 | 267 | if( rc==2 ){ |
| 268 | 268 | fossil_fatal("no such file: %s", g.argv[i]); |
| 269 | 269 | } |
| 270 | 270 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -73,11 +73,11 @@ | |
| 73 | vid = db_lget_int("checkout", 0); |
| 74 | if( vid==0 ){ |
| 75 | fossil_fatal("no checkout to finfo files in"); |
| 76 | } |
| 77 | vfile_check_signature(vid, CKSIG_ENOTFILE); |
| 78 | file_tree_name(g.argv[2], &fname, 1); |
| 79 | db_prepare(&q, |
| 80 | "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)" |
| 81 | " FROM vfile WHERE vfile.pathname=%B %s", |
| 82 | &fname, filename_collation()); |
| 83 | blob_zero(&line); |
| @@ -122,11 +122,11 @@ | |
| 122 | const char *zRevision = find_option("revision", "r", 1); |
| 123 | |
| 124 | /* We should be done with options.. */ |
| 125 | verify_all_options(); |
| 126 | |
| 127 | file_tree_name(g.argv[2], &fname, 1); |
| 128 | if( zRevision ){ |
| 129 | historical_version_of_file(zRevision, blob_str(&fname), &record, 0,0,0,0); |
| 130 | }else{ |
| 131 | int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B %s", |
| 132 | &fname, filename_collation()); |
| @@ -174,11 +174,11 @@ | |
| 174 | verify_all_options(); |
| 175 | |
| 176 | if( g.argc!=3 ){ |
| 177 | usage("?-l|--log? ?-b|--brief? FILENAME"); |
| 178 | } |
| 179 | file_tree_name(g.argv[2], &fname, 1); |
| 180 | rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B %s", |
| 181 | &fname, filename_collation()); |
| 182 | if( rid==0 ){ |
| 183 | fossil_fatal("no history for file: %b", &fname); |
| 184 | } |
| @@ -259,11 +259,11 @@ | |
| 259 | |
| 260 | /* We should be done with options.. */ |
| 261 | verify_all_options(); |
| 262 | |
| 263 | for(i=2; i<g.argc; i++){ |
| 264 | file_tree_name(g.argv[i], &fname, 1); |
| 265 | blob_zero(&content); |
| 266 | rc = historical_version_of_file(zRev, blob_str(&fname), &content, 0,0,0,2); |
| 267 | if( rc==2 ){ |
| 268 | fossil_fatal("no such file: %s", g.argv[i]); |
| 269 | } |
| 270 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -73,11 +73,11 @@ | |
| 73 | vid = db_lget_int("checkout", 0); |
| 74 | if( vid==0 ){ |
| 75 | fossil_fatal("no checkout to finfo files in"); |
| 76 | } |
| 77 | vfile_check_signature(vid, CKSIG_ENOTFILE); |
| 78 | file_tree_name(g.argv[2], &fname, 0, 1); |
| 79 | db_prepare(&q, |
| 80 | "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)" |
| 81 | " FROM vfile WHERE vfile.pathname=%B %s", |
| 82 | &fname, filename_collation()); |
| 83 | blob_zero(&line); |
| @@ -122,11 +122,11 @@ | |
| 122 | const char *zRevision = find_option("revision", "r", 1); |
| 123 | |
| 124 | /* We should be done with options.. */ |
| 125 | verify_all_options(); |
| 126 | |
| 127 | file_tree_name(g.argv[2], &fname, 0, 1); |
| 128 | if( zRevision ){ |
| 129 | historical_version_of_file(zRevision, blob_str(&fname), &record, 0,0,0,0); |
| 130 | }else{ |
| 131 | int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B %s", |
| 132 | &fname, filename_collation()); |
| @@ -174,11 +174,11 @@ | |
| 174 | verify_all_options(); |
| 175 | |
| 176 | if( g.argc!=3 ){ |
| 177 | usage("?-l|--log? ?-b|--brief? FILENAME"); |
| 178 | } |
| 179 | file_tree_name(g.argv[2], &fname, 0, 1); |
| 180 | rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B %s", |
| 181 | &fname, filename_collation()); |
| 182 | if( rid==0 ){ |
| 183 | fossil_fatal("no history for file: %b", &fname); |
| 184 | } |
| @@ -259,11 +259,11 @@ | |
| 259 | |
| 260 | /* We should be done with options.. */ |
| 261 | verify_all_options(); |
| 262 | |
| 263 | for(i=2; i<g.argc; i++){ |
| 264 | file_tree_name(g.argv[i], &fname, 0, 1); |
| 265 | blob_zero(&content); |
| 266 | rc = historical_version_of_file(zRev, blob_str(&fname), &content, 0,0,0,2); |
| 267 | if( rc==2 ){ |
| 268 | fossil_fatal("no such file: %s", g.argv[i]); |
| 269 | } |
| 270 |
+1
-1
| --- src/stash.c | ||
| +++ src/stash.c | ||
| @@ -58,11 +58,11 @@ | ||
| 58 | 58 | Blob sql; /* Query statement text */ |
| 59 | 59 | Stmt q; /* Query against the vfile table */ |
| 60 | 60 | Stmt ins; /* Insert statement */ |
| 61 | 61 | |
| 62 | 62 | zFile = mprintf("%/", zFName); |
| 63 | - file_tree_name(zFile, &fname, 1); | |
| 63 | + file_tree_name(zFile, &fname, 0, 1); | |
| 64 | 64 | zTreename = blob_str(&fname); |
| 65 | 65 | blob_zero(&sql); |
| 66 | 66 | blob_append_sql(&sql, |
| 67 | 67 | "SELECT deleted, isexe, islink, mrid, pathname, coalesce(origname,pathname)" |
| 68 | 68 | " FROM vfile" |
| 69 | 69 |
| --- src/stash.c | |
| +++ src/stash.c | |
| @@ -58,11 +58,11 @@ | |
| 58 | Blob sql; /* Query statement text */ |
| 59 | Stmt q; /* Query against the vfile table */ |
| 60 | Stmt ins; /* Insert statement */ |
| 61 | |
| 62 | zFile = mprintf("%/", zFName); |
| 63 | file_tree_name(zFile, &fname, 1); |
| 64 | zTreename = blob_str(&fname); |
| 65 | blob_zero(&sql); |
| 66 | blob_append_sql(&sql, |
| 67 | "SELECT deleted, isexe, islink, mrid, pathname, coalesce(origname,pathname)" |
| 68 | " FROM vfile" |
| 69 |
| --- src/stash.c | |
| +++ src/stash.c | |
| @@ -58,11 +58,11 @@ | |
| 58 | Blob sql; /* Query statement text */ |
| 59 | Stmt q; /* Query against the vfile table */ |
| 60 | Stmt ins; /* Insert statement */ |
| 61 | |
| 62 | zFile = mprintf("%/", zFName); |
| 63 | file_tree_name(zFile, &fname, 0, 1); |
| 64 | zTreename = blob_str(&fname); |
| 65 | blob_zero(&sql); |
| 66 | blob_append_sql(&sql, |
| 67 | "SELECT deleted, isexe, islink, mrid, pathname, coalesce(origname,pathname)" |
| 68 | " FROM vfile" |
| 69 |
+1
-1
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -2085,11 +2085,11 @@ | ||
| 2085 | 2085 | if( zType==0 ){ |
| 2086 | 2086 | /* When zFilePattern is specified and type is not specified, only show |
| 2087 | 2087 | * file check-ins */ |
| 2088 | 2088 | zType="ci"; |
| 2089 | 2089 | } |
| 2090 | - file_tree_name(zFilePattern, &treeName, 1); | |
| 2090 | + file_tree_name(zFilePattern, &treeName, 0, 1); | |
| 2091 | 2091 | if( fossil_strcmp(blob_str(&treeName), ".")==0 ){ |
| 2092 | 2092 | /* When zTreeName refers to g.zLocalRoot, it's like not specifying |
| 2093 | 2093 | * zFilePattern. */ |
| 2094 | 2094 | zFilePattern = 0; |
| 2095 | 2095 | } |
| 2096 | 2096 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -2085,11 +2085,11 @@ | |
| 2085 | if( zType==0 ){ |
| 2086 | /* When zFilePattern is specified and type is not specified, only show |
| 2087 | * file check-ins */ |
| 2088 | zType="ci"; |
| 2089 | } |
| 2090 | file_tree_name(zFilePattern, &treeName, 1); |
| 2091 | if( fossil_strcmp(blob_str(&treeName), ".")==0 ){ |
| 2092 | /* When zTreeName refers to g.zLocalRoot, it's like not specifying |
| 2093 | * zFilePattern. */ |
| 2094 | zFilePattern = 0; |
| 2095 | } |
| 2096 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -2085,11 +2085,11 @@ | |
| 2085 | if( zType==0 ){ |
| 2086 | /* When zFilePattern is specified and type is not specified, only show |
| 2087 | * file check-ins */ |
| 2088 | zType="ci"; |
| 2089 | } |
| 2090 | file_tree_name(zFilePattern, &treeName, 0, 1); |
| 2091 | if( fossil_strcmp(blob_str(&treeName), ".")==0 ){ |
| 2092 | /* When zTreeName refers to g.zLocalRoot, it's like not specifying |
| 2093 | * zFilePattern. */ |
| 2094 | zFilePattern = 0; |
| 2095 | } |
| 2096 |
+1
-1
| --- src/undo.c | ||
| +++ src/undo.c | ||
| @@ -437,11 +437,11 @@ | ||
| 437 | 437 | fossil_fatal("nothing to %s", zCmd); |
| 438 | 438 | } |
| 439 | 439 | for(i=2; i<g.argc; i++){ |
| 440 | 440 | const char *zFile = g.argv[i]; |
| 441 | 441 | Blob path; |
| 442 | - file_tree_name(zFile, &path, 1); | |
| 442 | + file_tree_name(zFile, &path, 0, 1); | |
| 443 | 443 | undo_one(blob_str(&path), isRedo); |
| 444 | 444 | blob_reset(&path); |
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | 447 | vid2 = db_lget_int("checkout", 0); |
| 448 | 448 |
| --- src/undo.c | |
| +++ src/undo.c | |
| @@ -437,11 +437,11 @@ | |
| 437 | fossil_fatal("nothing to %s", zCmd); |
| 438 | } |
| 439 | for(i=2; i<g.argc; i++){ |
| 440 | const char *zFile = g.argv[i]; |
| 441 | Blob path; |
| 442 | file_tree_name(zFile, &path, 1); |
| 443 | undo_one(blob_str(&path), isRedo); |
| 444 | blob_reset(&path); |
| 445 | } |
| 446 | } |
| 447 | vid2 = db_lget_int("checkout", 0); |
| 448 |
| --- src/undo.c | |
| +++ src/undo.c | |
| @@ -437,11 +437,11 @@ | |
| 437 | fossil_fatal("nothing to %s", zCmd); |
| 438 | } |
| 439 | for(i=2; i<g.argc; i++){ |
| 440 | const char *zFile = g.argv[i]; |
| 441 | Blob path; |
| 442 | file_tree_name(zFile, &path, 0, 1); |
| 443 | undo_one(blob_str(&path), isRedo); |
| 444 | blob_reset(&path); |
| 445 | } |
| 446 | } |
| 447 | vid2 = db_lget_int("checkout", 0); |
| 448 |
+2
-2
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -352,11 +352,11 @@ | ||
| 352 | 352 | |
| 353 | 353 | blob_zero(&sql); |
| 354 | 354 | blob_append(&sql, "DELETE FROM fv WHERE ", -1); |
| 355 | 355 | zSep = ""; |
| 356 | 356 | for(i=3; i<g.argc; i++){ |
| 357 | - file_tree_name(g.argv[i], &treename, 1); | |
| 357 | + file_tree_name(g.argv[i], &treename, 0, 1); | |
| 358 | 358 | if( file_wd_isdir(g.argv[i])==1 ){ |
| 359 | 359 | if( blob_size(&treename) != 1 || blob_str(&treename)[0] != '.' ){ |
| 360 | 360 | blob_append_sql(&sql, "%sfn NOT GLOB '%q/*' ", |
| 361 | 361 | zSep /*safe-for-%s*/, blob_str(&treename)); |
| 362 | 362 | }else{ |
| @@ -738,11 +738,11 @@ | ||
| 738 | 738 | |
| 739 | 739 | if( g.argc>2 ){ |
| 740 | 740 | for(i=2; i<g.argc; i++){ |
| 741 | 741 | Blob fname; |
| 742 | 742 | zFile = mprintf("%/", g.argv[i]); |
| 743 | - file_tree_name(zFile, &fname, 1); | |
| 743 | + file_tree_name(zFile, &fname, 0, 1); | |
| 744 | 744 | db_multi_exec( |
| 745 | 745 | "REPLACE INTO torevert VALUES(%B);" |
| 746 | 746 | "INSERT OR IGNORE INTO torevert" |
| 747 | 747 | " SELECT pathname" |
| 748 | 748 | " FROM vfile" |
| 749 | 749 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -352,11 +352,11 @@ | |
| 352 | |
| 353 | blob_zero(&sql); |
| 354 | blob_append(&sql, "DELETE FROM fv WHERE ", -1); |
| 355 | zSep = ""; |
| 356 | for(i=3; i<g.argc; i++){ |
| 357 | file_tree_name(g.argv[i], &treename, 1); |
| 358 | if( file_wd_isdir(g.argv[i])==1 ){ |
| 359 | if( blob_size(&treename) != 1 || blob_str(&treename)[0] != '.' ){ |
| 360 | blob_append_sql(&sql, "%sfn NOT GLOB '%q/*' ", |
| 361 | zSep /*safe-for-%s*/, blob_str(&treename)); |
| 362 | }else{ |
| @@ -738,11 +738,11 @@ | |
| 738 | |
| 739 | if( g.argc>2 ){ |
| 740 | for(i=2; i<g.argc; i++){ |
| 741 | Blob fname; |
| 742 | zFile = mprintf("%/", g.argv[i]); |
| 743 | file_tree_name(zFile, &fname, 1); |
| 744 | db_multi_exec( |
| 745 | "REPLACE INTO torevert VALUES(%B);" |
| 746 | "INSERT OR IGNORE INTO torevert" |
| 747 | " SELECT pathname" |
| 748 | " FROM vfile" |
| 749 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -352,11 +352,11 @@ | |
| 352 | |
| 353 | blob_zero(&sql); |
| 354 | blob_append(&sql, "DELETE FROM fv WHERE ", -1); |
| 355 | zSep = ""; |
| 356 | for(i=3; i<g.argc; i++){ |
| 357 | file_tree_name(g.argv[i], &treename, 0, 1); |
| 358 | if( file_wd_isdir(g.argv[i])==1 ){ |
| 359 | if( blob_size(&treename) != 1 || blob_str(&treename)[0] != '.' ){ |
| 360 | blob_append_sql(&sql, "%sfn NOT GLOB '%q/*' ", |
| 361 | zSep /*safe-for-%s*/, blob_str(&treename)); |
| 362 | }else{ |
| @@ -738,11 +738,11 @@ | |
| 738 | |
| 739 | if( g.argc>2 ){ |
| 740 | for(i=2; i<g.argc; i++){ |
| 741 | Blob fname; |
| 742 | zFile = mprintf("%/", g.argv[i]); |
| 743 | file_tree_name(zFile, &fname, 0, 1); |
| 744 | db_multi_exec( |
| 745 | "REPLACE INTO torevert VALUES(%B);" |
| 746 | "INSERT OR IGNORE INTO torevert" |
| 747 | " SELECT pathname" |
| 748 | " FROM vfile" |
| 749 |