Fossil SCM

Fix the locate_unmanaged_files() routine so that it always see (and ignores) symbolic links.

drh 2020-08-21 11:19 sec2020
Commit 0938b56516d1536314133c1756de249b08432d24da391b91786a9cd375a65525
1 file changed +6 -3
+6 -3
--- src/checkin.c
+++ src/checkin.c
@@ -62,10 +62,13 @@
6262
** Create a TEMP table named SFILE and add all unmanaged files named on
6363
** the command-line to that table. If directories are named, then add
6464
** all unmanaged files contained underneath those directories. If there
6565
** are no files or directories named on the command-line, then add all
6666
** unmanaged files anywhere in the checkout.
67
+**
68
+** This routine never follows symlinks. It always treats symlinks as
69
+** object unto themselves.
6770
*/
6871
static void locate_unmanaged_files(
6972
int argc, /* Number of command-line arguments to examine */
7073
char **argv, /* values of command-line arguments */
7174
unsigned scanFlags, /* Zero or more SCAN_xxx flags */
@@ -80,19 +83,19 @@
8083
db_multi_exec("CREATE TEMP TABLE sfile(pathname TEXT PRIMARY KEY %s,"
8184
" mtime INTEGER, size INTEGER)", filename_collation());
8285
nRoot = (int)strlen(g.zLocalRoot);
8386
if( argc==0 ){
8487
blob_init(&name, g.zLocalRoot, nRoot - 1);
85
- vfile_scan(&name, blob_size(&name), scanFlags, pIgnore, 0, RepoFILE);
88
+ vfile_scan(&name, blob_size(&name), scanFlags, pIgnore, 0, SymFILE);
8689
blob_reset(&name);
8790
}else{
8891
for(i=0; i<argc; i++){
8992
file_canonical_name(argv[i], &name, 0);
9093
zName = blob_str(&name);
91
- isDir = file_isdir(zName, RepoFILE);
94
+ isDir = file_isdir(zName, SymFILE);
9295
if( isDir==1 ){
93
- vfile_scan(&name, nRoot-1, scanFlags, pIgnore, 0, RepoFILE);
96
+ vfile_scan(&name, nRoot-1, scanFlags, pIgnore, 0, SymFILE);
9497
}else if( isDir==0 ){
9598
fossil_warning("not found: %s", &zName[nRoot]);
9699
}else if( file_access(zName, R_OK) ){
97100
fossil_fatal("cannot open %s", &zName[nRoot]);
98101
}else{
99102
--- src/checkin.c
+++ src/checkin.c
@@ -62,10 +62,13 @@
62 ** Create a TEMP table named SFILE and add all unmanaged files named on
63 ** the command-line to that table. If directories are named, then add
64 ** all unmanaged files contained underneath those directories. If there
65 ** are no files or directories named on the command-line, then add all
66 ** unmanaged files anywhere in the checkout.
 
 
 
67 */
68 static void locate_unmanaged_files(
69 int argc, /* Number of command-line arguments to examine */
70 char **argv, /* values of command-line arguments */
71 unsigned scanFlags, /* Zero or more SCAN_xxx flags */
@@ -80,19 +83,19 @@
80 db_multi_exec("CREATE TEMP TABLE sfile(pathname TEXT PRIMARY KEY %s,"
81 " mtime INTEGER, size INTEGER)", filename_collation());
82 nRoot = (int)strlen(g.zLocalRoot);
83 if( argc==0 ){
84 blob_init(&name, g.zLocalRoot, nRoot - 1);
85 vfile_scan(&name, blob_size(&name), scanFlags, pIgnore, 0, RepoFILE);
86 blob_reset(&name);
87 }else{
88 for(i=0; i<argc; i++){
89 file_canonical_name(argv[i], &name, 0);
90 zName = blob_str(&name);
91 isDir = file_isdir(zName, RepoFILE);
92 if( isDir==1 ){
93 vfile_scan(&name, nRoot-1, scanFlags, pIgnore, 0, RepoFILE);
94 }else if( isDir==0 ){
95 fossil_warning("not found: %s", &zName[nRoot]);
96 }else if( file_access(zName, R_OK) ){
97 fossil_fatal("cannot open %s", &zName[nRoot]);
98 }else{
99
--- src/checkin.c
+++ src/checkin.c
@@ -62,10 +62,13 @@
62 ** Create a TEMP table named SFILE and add all unmanaged files named on
63 ** the command-line to that table. If directories are named, then add
64 ** all unmanaged files contained underneath those directories. If there
65 ** are no files or directories named on the command-line, then add all
66 ** unmanaged files anywhere in the checkout.
67 **
68 ** This routine never follows symlinks. It always treats symlinks as
69 ** object unto themselves.
70 */
71 static void locate_unmanaged_files(
72 int argc, /* Number of command-line arguments to examine */
73 char **argv, /* values of command-line arguments */
74 unsigned scanFlags, /* Zero or more SCAN_xxx flags */
@@ -80,19 +83,19 @@
83 db_multi_exec("CREATE TEMP TABLE sfile(pathname TEXT PRIMARY KEY %s,"
84 " mtime INTEGER, size INTEGER)", filename_collation());
85 nRoot = (int)strlen(g.zLocalRoot);
86 if( argc==0 ){
87 blob_init(&name, g.zLocalRoot, nRoot - 1);
88 vfile_scan(&name, blob_size(&name), scanFlags, pIgnore, 0, SymFILE);
89 blob_reset(&name);
90 }else{
91 for(i=0; i<argc; i++){
92 file_canonical_name(argv[i], &name, 0);
93 zName = blob_str(&name);
94 isDir = file_isdir(zName, SymFILE);
95 if( isDir==1 ){
96 vfile_scan(&name, nRoot-1, scanFlags, pIgnore, 0, SymFILE);
97 }else if( isDir==0 ){
98 fossil_warning("not found: %s", &zName[nRoot]);
99 }else if( file_access(zName, R_OK) ){
100 fossil_fatal("cannot open %s", &zName[nRoot]);
101 }else{
102

Keyboard Shortcuts

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