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.

mistachkin 2015-05-26 21:46 trunk
Commit c2df31dae8ad1b0edef7d7f329c8e5608484da2a
+10 -10
--- src/add.c
+++ src/add.c
@@ -91,11 +91,11 @@
9191
9292
if( cachedManifest == -1 ){
9393
Blob repo;
9494
cachedManifest = db_get_boolean("manifest",0);
9595
blob_zero(&repo);
96
- if( file_tree_name(g.zRepositoryName, &repo, 0) ){
96
+ if( file_tree_name(g.zRepositoryName, &repo, 0, 0) ){
9797
const char *zRepo = blob_str(&repo);
9898
azRepo[0] = zRepo;
9999
azRepo[1] = mprintf("%s-journal", zRepo);
100100
azRepo[2] = mprintf("%s-wal", zRepo);
101101
azRepo[3] = mprintf("%s-shm", zRepo);
@@ -201,11 +201,11 @@
201201
const char *zReserved; /* Name of a reserved file */
202202
Blob repoName; /* Treename of the repository */
203203
Stmt loop; /* SQL to loop over all files to add */
204204
int (*xCmp)(const char*,const char*);
205205
206
- if( !file_tree_name(g.zRepositoryName, &repoName, 0) ){
206
+ if( !file_tree_name(g.zRepositoryName, &repoName, 0, 0) ){
207207
blob_zero(&repoName);
208208
zRepo = "";
209209
}else{
210210
zRepo = blob_str(&repoName);
211211
}
@@ -307,11 +307,11 @@
307307
int isDir;
308308
Blob fullName;
309309
310310
/* file_tree_name() throws a fatal error if g.argv[i] is outside of the
311311
** checkout. */
312
- file_tree_name(g.argv[i], &fullName, 1);
312
+ file_tree_name(g.argv[i], &fullName, 0, 1);
313313
blob_reset(&fullName);
314314
315315
file_canonical_name(g.argv[i], &fullName, 0);
316316
zName = blob_str(&fullName);
317317
isDir = file_wd_isdir(zName);
@@ -365,11 +365,11 @@
365365
if( !tableCreated ){
366366
db_multi_exec("CREATE TEMP TABLE fremove(x TEXT PRIMARY KEY %s)",
367367
filename_collation());
368368
tableCreated = 1;
369369
}
370
- file_canonical_name(zOldName, &fullOldName, 0);
370
+ file_tree_name(zOldName, &fullOldName, 1, 1);
371371
db_multi_exec("INSERT INTO fremove VALUES('%q');", blob_str(&fullOldName));
372372
blob_reset(&fullOldName);
373373
}
374374
375375
/*
@@ -464,11 +464,11 @@
464464
filename_collation());
465465
for(i=2; i<g.argc; i++){
466466
Blob treeName;
467467
char *zTreeName;
468468
469
- file_tree_name(g.argv[i], &treeName, 1);
469
+ file_tree_name(g.argv[i], &treeName, 0, 1);
470470
zTreeName = blob_str(&treeName);
471471
db_multi_exec(
472472
"INSERT OR IGNORE INTO sfile"
473473
" SELECT pathname FROM vfile"
474474
" WHERE (pathname=%Q %s"
@@ -746,12 +746,12 @@
746746
if( !tableCreated ){
747747
db_multi_exec("CREATE TEMP TABLE fmove(x TEXT PRIMARY KEY %s, y TEXT %s)",
748748
filename_collation(), filename_collation());
749749
tableCreated = 1;
750750
}
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);
753753
db_multi_exec("INSERT INTO fmove VALUES('%q','%q');",
754754
blob_str(&fullOldName), blob_str(&fullNewName));
755755
blob_reset(&fullNewName);
756756
blob_reset(&fullOldName);
757757
}
@@ -860,11 +860,11 @@
860860
moveFiles = db_get_boolean("mv-rm-files",0);
861861
#else
862862
moveFiles = FOSSIL_MV_RM_FILE;
863863
#endif
864864
}
865
- file_tree_name(zDest, &dest, 1);
865
+ file_tree_name(zDest, &dest, 0, 1);
866866
db_multi_exec(
867867
"UPDATE vfile SET origname=pathname WHERE origname IS NULL;"
868868
);
869869
db_multi_exec(
870870
"CREATE TEMP TABLE mv(f TEXT UNIQUE ON CONFLICT IGNORE, t TEXT);"
@@ -872,11 +872,11 @@
872872
if( file_wd_isdir(zDest)!=1 ){
873873
Blob orig;
874874
if( g.argc!=4 ){
875875
usage("OLDNAME NEWNAME");
876876
}
877
- file_tree_name(g.argv[2], &orig, 1);
877
+ file_tree_name(g.argv[2], &orig, 0, 1);
878878
db_multi_exec(
879879
"INSERT INTO mv VALUES(%B,%B)", &orig, &dest
880880
);
881881
}else{
882882
if( blob_eq(&dest, ".") ){
@@ -886,11 +886,11 @@
886886
}
887887
for(i=2; i<g.argc-1; i++){
888888
Blob orig;
889889
char *zOrig;
890890
int nOrig;
891
- file_tree_name(g.argv[i], &orig, 1);
891
+ file_tree_name(g.argv[i], &orig, 0, 1);
892892
zOrig = blob_str(&orig);
893893
nOrig = blob_size(&orig);
894894
db_prepare(&q,
895895
"SELECT pathname FROM vfile"
896896
" WHERE vid=%d"
897897
--- 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 @@
4646
int i;
4747
4848
blob_zero(&where);
4949
for(i=2; i<g.argc; i++){
5050
Blob fname;
51
- file_tree_name(g.argv[i], &fname, 1);
51
+ file_tree_name(g.argv[i], &fname, 0, 1);
5252
zName = blob_str(&fname);
5353
if( fossil_strcmp(zName, ".")==0 ){
5454
blob_reset(&where);
5555
break;
5656
}
@@ -296,11 +296,11 @@
296296
297297
/* Handle given file names */
298298
blob_zero(&where);
299299
for(i=2; i<g.argc; i++){
300300
Blob fname;
301
- file_tree_name(g.argv[i], &fname, 1);
301
+ file_tree_name(g.argv[i], &fname, 0, 1);
302302
zName = blob_str(&fname);
303303
if( fossil_strcmp(zName, ".")==0 ){
304304
blob_reset(&where);
305305
break;
306306
}
@@ -409,11 +409,11 @@
409409
}
410410
verify_all_options();
411411
blob_zero(&where);
412412
for(i=2; i<g.argc; i++){
413413
Blob fname;
414
- file_tree_name(g.argv[i], &fname, 1);
414
+ file_tree_name(g.argv[i], &fname, 0, 1);
415415
zName = blob_str(&fname);
416416
if( fossil_strcmp(zName, ".")==0 ){
417417
blob_reset(&where);
418418
break;
419419
}
@@ -741,11 +741,11 @@
741741
"SELECT %Q || x FROM sfile"
742742
" WHERE x NOT IN (%s)"
743743
" ORDER BY 1",
744744
g.zLocalRoot, fossil_all_reserved_names(0)
745745
);
746
- if( file_tree_name(g.zRepositoryName, &repo, 0) ){
746
+ if( file_tree_name(g.zRepositoryName, &repo, 0, 0) ){
747747
db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
748748
}
749749
db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
750750
while( db_step(&q)==SQLITE_ROW ){
751751
const char *zName = db_column_text(&q, 0);
@@ -1037,11 +1037,11 @@
10371037
10381038
blob_zero(&fname);
10391039
bag_init(&toCommit);
10401040
for(ii=2; ii<g.argc; ii++){
10411041
int cnt = 0;
1042
- file_tree_name(g.argv[ii], &fname, 1);
1042
+ file_tree_name(g.argv[ii], &fname, 0, 1);
10431043
if( fossil_strcmp(blob_str(&fname),".")==0 ){
10441044
bag_clear(&toCommit);
10451045
return result;
10461046
}
10471047
db_prepare(&q,
10481048
--- 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 @@
24572457
verify_all_options();
24582458
24592459
if( g.argc<3 ) {
24602460
usage("FILENAME");
24612461
}
2462
- file_tree_name(g.argv[2], &treename, 1);
2462
+ file_tree_name(g.argv[2], &treename, 0, 1);
24632463
zFilename = blob_str(&treename);
24642464
fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename);
24652465
if( fnid==0 ){
24662466
fossil_fatal("no such file: %s", zFilename);
24672467
}
24682468
--- 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 @@
298298
){
299299
Blob fname;
300300
Blob content;
301301
int isLink;
302302
int isBin;
303
- file_tree_name(zFileTreeName, &fname, 1);
303
+ file_tree_name(zFileTreeName, &fname, 0, 1);
304304
historical_version_of_file(zFrom, blob_str(&fname), &content, &isLink, 0,
305305
fIncludeBinary ? 0 : &isBin, 0);
306306
if( !isLink != !file_wd_islink(zFrom) ){
307307
fossil_print("%s",DIFF_CANNOT_COMPUTE_SYMLINK);
308308
}else{
@@ -454,11 +454,11 @@
454454
Blob fname;
455455
Blob v1, v2;
456456
int isLink1, isLink2;
457457
int isBin1, isBin2;
458458
if( diffFlags & DIFF_BRIEF ) return;
459
- file_tree_name(zFileTreeName, &fname, 1);
459
+ file_tree_name(zFileTreeName, &fname, 0, 1);
460460
zName = blob_str(&fname);
461461
historical_version_of_file(zFrom, zName, &v1, &isLink1, 0,
462462
fIncludeBinary ? 0 : &isBin1, 0);
463463
historical_version_of_file(zTo, zName, &v2, &isLink2, 0,
464464
fIncludeBinary ? 0 : &isBin2, 0);
465465
--- 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 @@
10291029
blob_reset(&x);
10301030
}
10311031
}
10321032
10331033
/*
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.
10401042
*/
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
+){
10421049
Blob localRoot;
10431050
int nLocalRoot;
10441051
char *zLocalRoot;
10451052
Blob full;
10461053
int nFull;
@@ -1066,11 +1073,15 @@
10661073
}
10671074
10681075
/* Special case. zOrigName refers to g.zLocalRoot directory. */
10691076
if( (nFull==nLocalRoot-1 && xCmp(zLocalRoot, zFull, nFull)==0)
10701077
|| (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
+ }
10721083
blob_reset(&localRoot);
10731084
blob_reset(&full);
10741085
return 1;
10751086
}
10761087
@@ -1080,11 +1091,20 @@
10801091
if( errFatal ){
10811092
fossil_fatal("file outside of checkout tree: %s", zOrigName);
10821093
}
10831094
return 0;
10841095
}
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
+ }
10861106
blob_reset(&localRoot);
10871107
blob_reset(&full);
10881108
return 1;
10891109
}
10901110
@@ -1092,20 +1112,22 @@
10921112
** COMMAND: test-tree-name
10931113
**
10941114
** Test the operation of the tree name generator.
10951115
**
10961116
** Options:
1117
+** --absolute Return an absolute path intead of a relative one.
10971118
** --case-sensitive B Enable or disable case-sensitive filenames. B is
10981119
** a boolean: "yes", "no", "true", "false", etc.
10991120
*/
11001121
void cmd_test_tree_name(void){
11011122
int i;
11021123
Blob x;
1124
+ int absoluteFlag = find_option("absolute",0,0)!=0;
11031125
db_find_and_open_repository(0,0);
11041126
blob_zero(&x);
11051127
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) ){
11071129
fossil_print("%s\n", blob_buffer(&x));
11081130
blob_reset(&x);
11091131
}
11101132
}
11111133
}
11121134
--- 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 @@
7373
vid = db_lget_int("checkout", 0);
7474
if( vid==0 ){
7575
fossil_fatal("no checkout to finfo files in");
7676
}
7777
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);
7979
db_prepare(&q,
8080
"SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)"
8181
" FROM vfile WHERE vfile.pathname=%B %s",
8282
&fname, filename_collation());
8383
blob_zero(&line);
@@ -122,11 +122,11 @@
122122
const char *zRevision = find_option("revision", "r", 1);
123123
124124
/* We should be done with options.. */
125125
verify_all_options();
126126
127
- file_tree_name(g.argv[2], &fname, 1);
127
+ file_tree_name(g.argv[2], &fname, 0, 1);
128128
if( zRevision ){
129129
historical_version_of_file(zRevision, blob_str(&fname), &record, 0,0,0,0);
130130
}else{
131131
int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B %s",
132132
&fname, filename_collation());
@@ -174,11 +174,11 @@
174174
verify_all_options();
175175
176176
if( g.argc!=3 ){
177177
usage("?-l|--log? ?-b|--brief? FILENAME");
178178
}
179
- file_tree_name(g.argv[2], &fname, 1);
179
+ file_tree_name(g.argv[2], &fname, 0, 1);
180180
rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B %s",
181181
&fname, filename_collation());
182182
if( rid==0 ){
183183
fossil_fatal("no history for file: %b", &fname);
184184
}
@@ -259,11 +259,11 @@
259259
260260
/* We should be done with options.. */
261261
verify_all_options();
262262
263263
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);
265265
blob_zero(&content);
266266
rc = historical_version_of_file(zRev, blob_str(&fname), &content, 0,0,0,2);
267267
if( rc==2 ){
268268
fossil_fatal("no such file: %s", g.argv[i]);
269269
}
270270
--- 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 @@
5858
Blob sql; /* Query statement text */
5959
Stmt q; /* Query against the vfile table */
6060
Stmt ins; /* Insert statement */
6161
6262
zFile = mprintf("%/", zFName);
63
- file_tree_name(zFile, &fname, 1);
63
+ file_tree_name(zFile, &fname, 0, 1);
6464
zTreename = blob_str(&fname);
6565
blob_zero(&sql);
6666
blob_append_sql(&sql,
6767
"SELECT deleted, isexe, islink, mrid, pathname, coalesce(origname,pathname)"
6868
" FROM vfile"
6969
--- 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 @@
20852085
if( zType==0 ){
20862086
/* When zFilePattern is specified and type is not specified, only show
20872087
* file check-ins */
20882088
zType="ci";
20892089
}
2090
- file_tree_name(zFilePattern, &treeName, 1);
2090
+ file_tree_name(zFilePattern, &treeName, 0, 1);
20912091
if( fossil_strcmp(blob_str(&treeName), ".")==0 ){
20922092
/* When zTreeName refers to g.zLocalRoot, it's like not specifying
20932093
* zFilePattern. */
20942094
zFilePattern = 0;
20952095
}
20962096
--- 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 @@
437437
fossil_fatal("nothing to %s", zCmd);
438438
}
439439
for(i=2; i<g.argc; i++){
440440
const char *zFile = g.argv[i];
441441
Blob path;
442
- file_tree_name(zFile, &path, 1);
442
+ file_tree_name(zFile, &path, 0, 1);
443443
undo_one(blob_str(&path), isRedo);
444444
blob_reset(&path);
445445
}
446446
}
447447
vid2 = db_lget_int("checkout", 0);
448448
--- 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 @@
352352
353353
blob_zero(&sql);
354354
blob_append(&sql, "DELETE FROM fv WHERE ", -1);
355355
zSep = "";
356356
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);
358358
if( file_wd_isdir(g.argv[i])==1 ){
359359
if( blob_size(&treename) != 1 || blob_str(&treename)[0] != '.' ){
360360
blob_append_sql(&sql, "%sfn NOT GLOB '%q/*' ",
361361
zSep /*safe-for-%s*/, blob_str(&treename));
362362
}else{
@@ -738,11 +738,11 @@
738738
739739
if( g.argc>2 ){
740740
for(i=2; i<g.argc; i++){
741741
Blob fname;
742742
zFile = mprintf("%/", g.argv[i]);
743
- file_tree_name(zFile, &fname, 1);
743
+ file_tree_name(zFile, &fname, 0, 1);
744744
db_multi_exec(
745745
"REPLACE INTO torevert VALUES(%B);"
746746
"INSERT OR IGNORE INTO torevert"
747747
" SELECT pathname"
748748
" FROM vfile"
749749
--- 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

Keyboard Shortcuts

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