Fossil SCM

Fix `fossil clean` on symlinks by refactoring file_isfile_or_link() to take eFType as well, so that SymFILE doesn't get dropped but passed along instead.

js 2025-06-21 23:36 morphos merge
Commit 4b6dbb2e3a1c06b63a9aa908415dae3f955d04c1783837d61a32aed82980be7a
+2 -2
--- src/add.c
+++ src/add.c
@@ -295,11 +295,11 @@
295295
/* Restore contents of missing un-rm'd files. We don't do this
296296
** unconditionally because we might cause data loss if a file
297297
** is modified, rm'd, then un-rm'd.
298298
*/
299299
++nReset;
300
- if(!file_isfile_or_link(blob_str(&relName))){
300
+ if(!file_isfile_or_link(blob_str(&relName), RepoFILE)){
301301
if(bDryRun==0){
302302
vfile_to_disk(0, id, 0, 0);
303303
if(bVerbose){
304304
fossil_print("Restored missing file: %b\n", &relName);
305305
}
@@ -870,11 +870,11 @@
870870
const char *zFile;
871871
const char *zPath;
872872
873873
zFile = db_column_text(&q, 0);
874874
zPath = db_column_text(&q, 1);
875
- if( !file_isfile_or_link(zPath) ){
875
+ if( !file_isfile_or_link(zPath, RepoFILE) ){
876876
if( !dryRunFlag ){
877877
db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zFile);
878878
}
879879
fossil_print("DELETED %s\n", zFile);
880880
nDelete++;
881881
--- src/add.c
+++ src/add.c
@@ -295,11 +295,11 @@
295 /* Restore contents of missing un-rm'd files. We don't do this
296 ** unconditionally because we might cause data loss if a file
297 ** is modified, rm'd, then un-rm'd.
298 */
299 ++nReset;
300 if(!file_isfile_or_link(blob_str(&relName))){
301 if(bDryRun==0){
302 vfile_to_disk(0, id, 0, 0);
303 if(bVerbose){
304 fossil_print("Restored missing file: %b\n", &relName);
305 }
@@ -870,11 +870,11 @@
870 const char *zFile;
871 const char *zPath;
872
873 zFile = db_column_text(&q, 0);
874 zPath = db_column_text(&q, 1);
875 if( !file_isfile_or_link(zPath) ){
876 if( !dryRunFlag ){
877 db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zFile);
878 }
879 fossil_print("DELETED %s\n", zFile);
880 nDelete++;
881
--- src/add.c
+++ src/add.c
@@ -295,11 +295,11 @@
295 /* Restore contents of missing un-rm'd files. We don't do this
296 ** unconditionally because we might cause data loss if a file
297 ** is modified, rm'd, then un-rm'd.
298 */
299 ++nReset;
300 if(!file_isfile_or_link(blob_str(&relName), RepoFILE)){
301 if(bDryRun==0){
302 vfile_to_disk(0, id, 0, 0);
303 if(bVerbose){
304 fossil_print("Restored missing file: %b\n", &relName);
305 }
@@ -870,11 +870,11 @@
870 const char *zFile;
871 const char *zPath;
872
873 zFile = db_column_text(&q, 0);
874 zPath = db_column_text(&q, 1);
875 if( !file_isfile_or_link(zPath, RepoFILE) ){
876 if( !dryRunFlag ){
877 db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zFile);
878 }
879 fossil_print("DELETED %s\n", zFile);
880 nDelete++;
881
+2 -2
--- src/checkin.c
+++ src/checkin.c
@@ -218,11 +218,11 @@
218218
int isChnged = db_column_int(&q, 4);
219219
int isNew = isManaged && !db_column_int(&q, 5);
220220
int isRenamed = db_column_int(&q, 6);
221221
const char *zOrigName = 0;
222222
char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
223
- int isMissing = !file_isfile_or_link(zFullName);
223
+ int isMissing = !file_isfile_or_link(zFullName, RepoFILE);
224224
225225
/* Determine the file change classification, if any. */
226226
if( isDeleted ){
227227
if( flags & C_DELETED ){
228228
zClass = "DELETED";
@@ -926,11 +926,11 @@
926926
if( verboseFlag ){
927927
if( isNew ){
928928
type = "ADDED ";
929929
}else if( isDeleted ){
930930
type = "DELETED ";
931
- }else if( !file_isfile_or_link(zFullName) ){
931
+ }else if( !file_isfile_or_link(zFullName, RepoFILE) ){
932932
if( file_access(zFullName, F_OK)==0 ){
933933
type = "NOT_A_FILE ";
934934
}else{
935935
type = "MISSING ";
936936
}
937937
--- src/checkin.c
+++ src/checkin.c
@@ -218,11 +218,11 @@
218 int isChnged = db_column_int(&q, 4);
219 int isNew = isManaged && !db_column_int(&q, 5);
220 int isRenamed = db_column_int(&q, 6);
221 const char *zOrigName = 0;
222 char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
223 int isMissing = !file_isfile_or_link(zFullName);
224
225 /* Determine the file change classification, if any. */
226 if( isDeleted ){
227 if( flags & C_DELETED ){
228 zClass = "DELETED";
@@ -926,11 +926,11 @@
926 if( verboseFlag ){
927 if( isNew ){
928 type = "ADDED ";
929 }else if( isDeleted ){
930 type = "DELETED ";
931 }else if( !file_isfile_or_link(zFullName) ){
932 if( file_access(zFullName, F_OK)==0 ){
933 type = "NOT_A_FILE ";
934 }else{
935 type = "MISSING ";
936 }
937
--- src/checkin.c
+++ src/checkin.c
@@ -218,11 +218,11 @@
218 int isChnged = db_column_int(&q, 4);
219 int isNew = isManaged && !db_column_int(&q, 5);
220 int isRenamed = db_column_int(&q, 6);
221 const char *zOrigName = 0;
222 char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
223 int isMissing = !file_isfile_or_link(zFullName, RepoFILE);
224
225 /* Determine the file change classification, if any. */
226 if( isDeleted ){
227 if( flags & C_DELETED ){
228 zClass = "DELETED";
@@ -926,11 +926,11 @@
926 if( verboseFlag ){
927 if( isNew ){
928 type = "ADDED ";
929 }else if( isDeleted ){
930 type = "DELETED ";
931 }else if( !file_isfile_or_link(zFullName, RepoFILE) ){
932 if( file_access(zFullName, F_OK)==0 ){
933 type = "NOT_A_FILE ";
934 }else{
935 type = "MISSING ";
936 }
937
+40 -27
--- src/file.c
+++ src/file.c
@@ -217,12 +217,12 @@
217217
** (1) zFilename is an ordinary file
218218
**
219219
** (2) allow_symlinks is on and zFilename is a symbolic link to
220220
** a file, directory, or other object
221221
*/
222
-int file_isfile_or_link(const char *zFilename){
223
- if( getStat(zFilename, RepoFILE) ){
222
+int file_isfile_or_link(const char *zFilename, int eFType){
223
+ if( getStat(zFilename, eFType) ){
224224
return 0; /* stat() failed. Return false. */
225225
}
226226
return S_ISREG(fx.fileStat.st_mode) || S_ISLNK(fx.fileStat.st_mode);
227227
}
228228
@@ -1612,57 +1612,69 @@
16121612
file_canonical_name(zPath, &x, slash);
16131613
zFull = blob_str(&x);
16141614
fossil_print("[%s] -> [%s]\n", zPath, zFull);
16151615
memset(&testFileStat, 0, sizeof(struct fossilStat));
16161616
rc = fossil_stat(zPath, &testFileStat, 0);
1617
- fossil_print(" stat_rc = %d\n", rc);
1617
+ fossil_print(" stat_rc = %d\n", rc);
16181618
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", testFileStat.st_size);
1619
- fossil_print(" stat_size = %s\n", zBuf);
1619
+ fossil_print(" stat_size = %s\n", zBuf);
16201620
if( g.db==0 ) sqlite3_open(":memory:", &g.db);
16211621
z = db_text(0, "SELECT datetime(%lld, 'unixepoch')", testFileStat.st_mtime);
16221622
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld (%s)", testFileStat.st_mtime, z);
16231623
fossil_free(z);
1624
- fossil_print(" stat_mtime = %s\n", zBuf);
1625
- fossil_print(" stat_mode = 0%o\n", testFileStat.st_mode);
1624
+ fossil_print(" stat_mtime = %s\n", zBuf);
1625
+ fossil_print(" stat_mode = 0%o\n",
1626
+ testFileStat.st_mode);
16261627
memset(&testFileStat, 0, sizeof(struct fossilStat));
16271628
rc = fossil_stat(zPath, &testFileStat, 1);
1628
- fossil_print(" l_stat_rc = %d\n", rc);
1629
+ fossil_print(" l_stat_rc = %d\n", rc);
16291630
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", testFileStat.st_size);
1630
- fossil_print(" l_stat_size = %s\n", zBuf);
1631
+ fossil_print(" l_stat_size = %s\n", zBuf);
16311632
z = db_text(0, "SELECT datetime(%lld, 'unixepoch')", testFileStat.st_mtime);
16321633
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld (%s)", testFileStat.st_mtime, z);
16331634
fossil_free(z);
1634
- fossil_print(" l_stat_mtime = %s\n", zBuf);
1635
- fossil_print(" l_stat_mode = 0%o\n", testFileStat.st_mode);
1635
+ fossil_print(" l_stat_mtime = %s\n", zBuf);
1636
+ fossil_print(" l_stat_mode = 0%o\n",
1637
+ testFileStat.st_mode);
16361638
if( reset ) resetStat();
16371639
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_size(zPath,ExtFILE));
1638
- fossil_print(" file_size(ExtFILE) = %s\n", zBuf);
1640
+ fossil_print(" file_size(ExtFILE) = %s\n", zBuf);
16391641
iMtime = file_mtime(zPath, ExtFILE);
16401642
z = db_text(0, "SELECT datetime(%lld, 'unixepoch')", iMtime);
16411643
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld (%s)", iMtime, z);
16421644
fossil_free(z);
1643
- fossil_print(" file_mtime(ExtFILE) = %s\n", zBuf);
1644
- fossil_print(" file_mode(ExtFILE) = 0%o\n", file_mode(zPath,ExtFILE));
1645
- fossil_print(" file_isfile(ExtFILE) = %d\n", file_isfile(zPath,ExtFILE));
1646
- fossil_print(" file_isdir(ExtFILE) = %d\n", file_isdir(zPath,ExtFILE));
1647
- fossil_print(" file_issocket() = %d\n", file_issocket(zPath));
1645
+ fossil_print(" file_mtime(ExtFILE) = %s\n", zBuf);
1646
+ fossil_print(" file_mode(ExtFILE) = 0%o\n",
1647
+ file_mode(zPath,ExtFILE));
1648
+ fossil_print(" file_isfile(ExtFILE) = %d\n",
1649
+ file_isfile(zPath,ExtFILE));
1650
+ fossil_print(" file_isdir(ExtFILE) = %d\n",
1651
+ file_isdir(zPath,ExtFILE));
1652
+ fossil_print(" file_issocket() = %d\n",
1653
+ file_issocket(zPath));
16481654
if( reset ) resetStat();
16491655
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_size(zPath,RepoFILE));
1650
- fossil_print(" file_size(RepoFILE) = %s\n", zBuf);
1656
+ fossil_print(" file_size(RepoFILE) = %s\n", zBuf);
16511657
iMtime = file_mtime(zPath,RepoFILE);
16521658
z = db_text(0, "SELECT datetime(%lld, 'unixepoch')", iMtime);
16531659
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld (%s)", iMtime, z);
16541660
fossil_free(z);
1655
- fossil_print(" file_mtime(RepoFILE) = %s\n", zBuf);
1656
- fossil_print(" file_mode(RepoFILE) = 0%o\n", file_mode(zPath,RepoFILE));
1657
- fossil_print(" file_isfile(RepoFILE) = %d\n", file_isfile(zPath,RepoFILE));
1658
- fossil_print(" file_isfile_or_link = %d\n", file_isfile_or_link(zPath));
1659
- fossil_print(" file_islink = %d\n", file_islink(zPath));
1660
- fossil_print(" file_isexe(RepoFILE) = %d\n", file_isexe(zPath,RepoFILE));
1661
- fossil_print(" file_isdir(RepoFILE) = %d\n", file_isdir(zPath,RepoFILE));
1662
- fossil_print(" file_is_repository = %d\n", file_is_repository(zPath));
1663
- fossil_print(" file_is_reserved_name = %d\n",
1661
+ fossil_print(" file_mtime(RepoFILE) = %s\n", zBuf);
1662
+ fossil_print(" file_mode(RepoFILE) = 0%o\n",
1663
+ file_mode(zPath,RepoFILE));
1664
+ fossil_print(" file_isfile(RepoFILE) = %d\n",
1665
+ file_isfile(zPath,RepoFILE));
1666
+ fossil_print(" file_isfile_or_link(RepoFILE) = %d\n",
1667
+ file_isfile_or_link(zPath,RepoFILE));
1668
+ fossil_print(" file_islink = %d\n", file_islink(zPath));
1669
+ fossil_print(" file_isexe(RepoFILE) = %d\n",
1670
+ file_isexe(zPath,RepoFILE));
1671
+ fossil_print(" file_isdir(RepoFILE) = %d\n",
1672
+ file_isdir(zPath,RepoFILE));
1673
+ fossil_print(" file_is_repository = %d\n",
1674
+ file_is_repository(zPath));
1675
+ fossil_print(" file_is_reserved_name = %d\n",
16641676
file_is_reserved_name(zFull,-1));
16651677
fossil_print(" file_in_cwd = %d\n", file_in_cwd(zPath));
16661678
blob_reset(&x);
16671679
if( reset ) resetStat();
16681680
}
@@ -1744,11 +1756,12 @@
17441756
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_size(zName,RepoFILE));
17451757
fossil_print(" file_size = %s\n", zBuf);
17461758
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_mtime(zName,RepoFILE));
17471759
fossil_print(" file_mtime = %s\n", zBuf);
17481760
fossil_print(" file_isfile = %d\n", file_isfile(zName,RepoFILE));
1749
- fossil_print(" file_isfile_or_link = %d\n", file_isfile_or_link(zName));
1761
+ fossil_print(" file_isfile_or_link = %d\n",
1762
+ file_isfile_or_link(zName,RepoFILE));
17501763
fossil_print(" file_islink = %d\n", file_islink(zName));
17511764
fossil_print(" file_isexe = %d\n", file_isexe(zName,RepoFILE));
17521765
fossil_print(" file_isdir = %d\n", file_isdir(zName,RepoFILE));
17531766
}
17541767
}
17551768
--- src/file.c
+++ src/file.c
@@ -217,12 +217,12 @@
217 ** (1) zFilename is an ordinary file
218 **
219 ** (2) allow_symlinks is on and zFilename is a symbolic link to
220 ** a file, directory, or other object
221 */
222 int file_isfile_or_link(const char *zFilename){
223 if( getStat(zFilename, RepoFILE) ){
224 return 0; /* stat() failed. Return false. */
225 }
226 return S_ISREG(fx.fileStat.st_mode) || S_ISLNK(fx.fileStat.st_mode);
227 }
228
@@ -1612,57 +1612,69 @@
1612 file_canonical_name(zPath, &x, slash);
1613 zFull = blob_str(&x);
1614 fossil_print("[%s] -> [%s]\n", zPath, zFull);
1615 memset(&testFileStat, 0, sizeof(struct fossilStat));
1616 rc = fossil_stat(zPath, &testFileStat, 0);
1617 fossil_print(" stat_rc = %d\n", rc);
1618 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", testFileStat.st_size);
1619 fossil_print(" stat_size = %s\n", zBuf);
1620 if( g.db==0 ) sqlite3_open(":memory:", &g.db);
1621 z = db_text(0, "SELECT datetime(%lld, 'unixepoch')", testFileStat.st_mtime);
1622 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld (%s)", testFileStat.st_mtime, z);
1623 fossil_free(z);
1624 fossil_print(" stat_mtime = %s\n", zBuf);
1625 fossil_print(" stat_mode = 0%o\n", testFileStat.st_mode);
 
1626 memset(&testFileStat, 0, sizeof(struct fossilStat));
1627 rc = fossil_stat(zPath, &testFileStat, 1);
1628 fossil_print(" l_stat_rc = %d\n", rc);
1629 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", testFileStat.st_size);
1630 fossil_print(" l_stat_size = %s\n", zBuf);
1631 z = db_text(0, "SELECT datetime(%lld, 'unixepoch')", testFileStat.st_mtime);
1632 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld (%s)", testFileStat.st_mtime, z);
1633 fossil_free(z);
1634 fossil_print(" l_stat_mtime = %s\n", zBuf);
1635 fossil_print(" l_stat_mode = 0%o\n", testFileStat.st_mode);
 
1636 if( reset ) resetStat();
1637 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_size(zPath,ExtFILE));
1638 fossil_print(" file_size(ExtFILE) = %s\n", zBuf);
1639 iMtime = file_mtime(zPath, ExtFILE);
1640 z = db_text(0, "SELECT datetime(%lld, 'unixepoch')", iMtime);
1641 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld (%s)", iMtime, z);
1642 fossil_free(z);
1643 fossil_print(" file_mtime(ExtFILE) = %s\n", zBuf);
1644 fossil_print(" file_mode(ExtFILE) = 0%o\n", file_mode(zPath,ExtFILE));
1645 fossil_print(" file_isfile(ExtFILE) = %d\n", file_isfile(zPath,ExtFILE));
1646 fossil_print(" file_isdir(ExtFILE) = %d\n", file_isdir(zPath,ExtFILE));
1647 fossil_print(" file_issocket() = %d\n", file_issocket(zPath));
 
 
 
 
1648 if( reset ) resetStat();
1649 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_size(zPath,RepoFILE));
1650 fossil_print(" file_size(RepoFILE) = %s\n", zBuf);
1651 iMtime = file_mtime(zPath,RepoFILE);
1652 z = db_text(0, "SELECT datetime(%lld, 'unixepoch')", iMtime);
1653 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld (%s)", iMtime, z);
1654 fossil_free(z);
1655 fossil_print(" file_mtime(RepoFILE) = %s\n", zBuf);
1656 fossil_print(" file_mode(RepoFILE) = 0%o\n", file_mode(zPath,RepoFILE));
1657 fossil_print(" file_isfile(RepoFILE) = %d\n", file_isfile(zPath,RepoFILE));
1658 fossil_print(" file_isfile_or_link = %d\n", file_isfile_or_link(zPath));
1659 fossil_print(" file_islink = %d\n", file_islink(zPath));
1660 fossil_print(" file_isexe(RepoFILE) = %d\n", file_isexe(zPath,RepoFILE));
1661 fossil_print(" file_isdir(RepoFILE) = %d\n", file_isdir(zPath,RepoFILE));
1662 fossil_print(" file_is_repository = %d\n", file_is_repository(zPath));
1663 fossil_print(" file_is_reserved_name = %d\n",
 
 
 
 
 
 
1664 file_is_reserved_name(zFull,-1));
1665 fossil_print(" file_in_cwd = %d\n", file_in_cwd(zPath));
1666 blob_reset(&x);
1667 if( reset ) resetStat();
1668 }
@@ -1744,11 +1756,12 @@
1744 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_size(zName,RepoFILE));
1745 fossil_print(" file_size = %s\n", zBuf);
1746 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_mtime(zName,RepoFILE));
1747 fossil_print(" file_mtime = %s\n", zBuf);
1748 fossil_print(" file_isfile = %d\n", file_isfile(zName,RepoFILE));
1749 fossil_print(" file_isfile_or_link = %d\n", file_isfile_or_link(zName));
 
1750 fossil_print(" file_islink = %d\n", file_islink(zName));
1751 fossil_print(" file_isexe = %d\n", file_isexe(zName,RepoFILE));
1752 fossil_print(" file_isdir = %d\n", file_isdir(zName,RepoFILE));
1753 }
1754 }
1755
--- src/file.c
+++ src/file.c
@@ -217,12 +217,12 @@
217 ** (1) zFilename is an ordinary file
218 **
219 ** (2) allow_symlinks is on and zFilename is a symbolic link to
220 ** a file, directory, or other object
221 */
222 int file_isfile_or_link(const char *zFilename, int eFType){
223 if( getStat(zFilename, eFType) ){
224 return 0; /* stat() failed. Return false. */
225 }
226 return S_ISREG(fx.fileStat.st_mode) || S_ISLNK(fx.fileStat.st_mode);
227 }
228
@@ -1612,57 +1612,69 @@
1612 file_canonical_name(zPath, &x, slash);
1613 zFull = blob_str(&x);
1614 fossil_print("[%s] -> [%s]\n", zPath, zFull);
1615 memset(&testFileStat, 0, sizeof(struct fossilStat));
1616 rc = fossil_stat(zPath, &testFileStat, 0);
1617 fossil_print(" stat_rc = %d\n", rc);
1618 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", testFileStat.st_size);
1619 fossil_print(" stat_size = %s\n", zBuf);
1620 if( g.db==0 ) sqlite3_open(":memory:", &g.db);
1621 z = db_text(0, "SELECT datetime(%lld, 'unixepoch')", testFileStat.st_mtime);
1622 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld (%s)", testFileStat.st_mtime, z);
1623 fossil_free(z);
1624 fossil_print(" stat_mtime = %s\n", zBuf);
1625 fossil_print(" stat_mode = 0%o\n",
1626 testFileStat.st_mode);
1627 memset(&testFileStat, 0, sizeof(struct fossilStat));
1628 rc = fossil_stat(zPath, &testFileStat, 1);
1629 fossil_print(" l_stat_rc = %d\n", rc);
1630 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", testFileStat.st_size);
1631 fossil_print(" l_stat_size = %s\n", zBuf);
1632 z = db_text(0, "SELECT datetime(%lld, 'unixepoch')", testFileStat.st_mtime);
1633 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld (%s)", testFileStat.st_mtime, z);
1634 fossil_free(z);
1635 fossil_print(" l_stat_mtime = %s\n", zBuf);
1636 fossil_print(" l_stat_mode = 0%o\n",
1637 testFileStat.st_mode);
1638 if( reset ) resetStat();
1639 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_size(zPath,ExtFILE));
1640 fossil_print(" file_size(ExtFILE) = %s\n", zBuf);
1641 iMtime = file_mtime(zPath, ExtFILE);
1642 z = db_text(0, "SELECT datetime(%lld, 'unixepoch')", iMtime);
1643 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld (%s)", iMtime, z);
1644 fossil_free(z);
1645 fossil_print(" file_mtime(ExtFILE) = %s\n", zBuf);
1646 fossil_print(" file_mode(ExtFILE) = 0%o\n",
1647 file_mode(zPath,ExtFILE));
1648 fossil_print(" file_isfile(ExtFILE) = %d\n",
1649 file_isfile(zPath,ExtFILE));
1650 fossil_print(" file_isdir(ExtFILE) = %d\n",
1651 file_isdir(zPath,ExtFILE));
1652 fossil_print(" file_issocket() = %d\n",
1653 file_issocket(zPath));
1654 if( reset ) resetStat();
1655 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_size(zPath,RepoFILE));
1656 fossil_print(" file_size(RepoFILE) = %s\n", zBuf);
1657 iMtime = file_mtime(zPath,RepoFILE);
1658 z = db_text(0, "SELECT datetime(%lld, 'unixepoch')", iMtime);
1659 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld (%s)", iMtime, z);
1660 fossil_free(z);
1661 fossil_print(" file_mtime(RepoFILE) = %s\n", zBuf);
1662 fossil_print(" file_mode(RepoFILE) = 0%o\n",
1663 file_mode(zPath,RepoFILE));
1664 fossil_print(" file_isfile(RepoFILE) = %d\n",
1665 file_isfile(zPath,RepoFILE));
1666 fossil_print(" file_isfile_or_link(RepoFILE) = %d\n",
1667 file_isfile_or_link(zPath,RepoFILE));
1668 fossil_print(" file_islink = %d\n", file_islink(zPath));
1669 fossil_print(" file_isexe(RepoFILE) = %d\n",
1670 file_isexe(zPath,RepoFILE));
1671 fossil_print(" file_isdir(RepoFILE) = %d\n",
1672 file_isdir(zPath,RepoFILE));
1673 fossil_print(" file_is_repository = %d\n",
1674 file_is_repository(zPath));
1675 fossil_print(" file_is_reserved_name = %d\n",
1676 file_is_reserved_name(zFull,-1));
1677 fossil_print(" file_in_cwd = %d\n", file_in_cwd(zPath));
1678 blob_reset(&x);
1679 if( reset ) resetStat();
1680 }
@@ -1744,11 +1756,12 @@
1756 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_size(zName,RepoFILE));
1757 fossil_print(" file_size = %s\n", zBuf);
1758 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_mtime(zName,RepoFILE));
1759 fossil_print(" file_mtime = %s\n", zBuf);
1760 fossil_print(" file_isfile = %d\n", file_isfile(zName,RepoFILE));
1761 fossil_print(" file_isfile_or_link = %d\n",
1762 file_isfile_or_link(zName,RepoFILE));
1763 fossil_print(" file_islink = %d\n", file_islink(zName));
1764 fossil_print(" file_isexe = %d\n", file_isexe(zName,RepoFILE));
1765 fossil_print(" file_isdir = %d\n", file_isdir(zName,RepoFILE));
1766 }
1767 }
1768
--- src/json_status.c
+++ src/json_status.c
@@ -115,11 +115,11 @@
115115
if( isDeleted ){
116116
zStatus = "deleted";
117117
}else if( isNew ){
118118
zStatus = "new" /* maintenance reminder: MUST come
119119
BEFORE the isChnged checks. */;
120
- }else if( !file_isfile_or_link(zFullName) ){
120
+ }else if( !file_isfile_or_link(zFullName, RepoFILE) ){
121121
if( file_access(zFullName, F_OK)==0 ){
122122
zStatus = "notAFile";
123123
++nErr;
124124
}else{
125125
zStatus = "missing";
126126
--- src/json_status.c
+++ src/json_status.c
@@ -115,11 +115,11 @@
115 if( isDeleted ){
116 zStatus = "deleted";
117 }else if( isNew ){
118 zStatus = "new" /* maintenance reminder: MUST come
119 BEFORE the isChnged checks. */;
120 }else if( !file_isfile_or_link(zFullName) ){
121 if( file_access(zFullName, F_OK)==0 ){
122 zStatus = "notAFile";
123 ++nErr;
124 }else{
125 zStatus = "missing";
126
--- src/json_status.c
+++ src/json_status.c
@@ -115,11 +115,11 @@
115 if( isDeleted ){
116 zStatus = "deleted";
117 }else if( isNew ){
118 zStatus = "new" /* maintenance reminder: MUST come
119 BEFORE the isChnged checks. */;
120 }else if( !file_isfile_or_link(zFullName, RepoFILE) ){
121 if( file_access(zFullName, F_OK)==0 ){
122 zStatus = "notAFile";
123 ++nErr;
124 }else{
125 zStatus = "missing";
126
+1 -1
--- src/merge.c
+++ src/merge.c
@@ -1560,11 +1560,11 @@
15601560
"FROM vfile WHERE id=%d",
15611561
vid, integrateFlag?5:3, idm
15621562
);
15631563
zName = db_column_text(&q, 1);
15641564
zFullName = mprintf("%s%s", g.zLocalRoot, zName);
1565
- if( file_isfile_or_link(zFullName)
1565
+ if( file_isfile_or_link(zFullName, RepoFILE)
15661566
&& !db_exists("SELECT 1 FROM fv WHERE fn=%Q", zName) ){
15671567
/* Name of backup file with Original content */
15681568
char *zOrig = file_newname(zFullName, "original", 1);
15691569
/* Backup previously unanaged file before to be overwritten */
15701570
file_copy(zFullName, zOrig);
15711571
--- src/merge.c
+++ src/merge.c
@@ -1560,11 +1560,11 @@
1560 "FROM vfile WHERE id=%d",
1561 vid, integrateFlag?5:3, idm
1562 );
1563 zName = db_column_text(&q, 1);
1564 zFullName = mprintf("%s%s", g.zLocalRoot, zName);
1565 if( file_isfile_or_link(zFullName)
1566 && !db_exists("SELECT 1 FROM fv WHERE fn=%Q", zName) ){
1567 /* Name of backup file with Original content */
1568 char *zOrig = file_newname(zFullName, "original", 1);
1569 /* Backup previously unanaged file before to be overwritten */
1570 file_copy(zFullName, zOrig);
1571
--- src/merge.c
+++ src/merge.c
@@ -1560,11 +1560,11 @@
1560 "FROM vfile WHERE id=%d",
1561 vid, integrateFlag?5:3, idm
1562 );
1563 zName = db_column_text(&q, 1);
1564 zFullName = mprintf("%s%s", g.zLocalRoot, zName);
1565 if( file_isfile_or_link(zFullName, RepoFILE)
1566 && !db_exists("SELECT 1 FROM fv WHERE fn=%Q", zName) ){
1567 /* Name of backup file with Original content */
1568 char *zOrig = file_newname(zFullName, "original", 1);
1569 /* Backup previously unanaged file before to be overwritten */
1570 file_copy(zFullName, zOrig);
1571
+1 -1
--- src/update.c
+++ src/update.c
@@ -448,11 +448,11 @@
448448
zOp = "CONFLICT";
449449
nc = 1;
450450
zErrMsg = "duplicate file";
451451
}else if( idt>0 && idv==0 ){
452452
/* File added in the target. */
453
- if( file_isfile_or_link(zFullPath) ){
453
+ if( file_isfile_or_link(zFullPath, RepoFILE) ){
454454
/* Name of backup file with Original content */
455455
char *zOrig = file_newname(zFullPath, "original", 1);
456456
/* Backup previously unanaged file before to be overwritten */
457457
file_copy(zFullPath, zOrig);
458458
fossil_free(zOrig);
459459
--- src/update.c
+++ src/update.c
@@ -448,11 +448,11 @@
448 zOp = "CONFLICT";
449 nc = 1;
450 zErrMsg = "duplicate file";
451 }else if( idt>0 && idv==0 ){
452 /* File added in the target. */
453 if( file_isfile_or_link(zFullPath) ){
454 /* Name of backup file with Original content */
455 char *zOrig = file_newname(zFullPath, "original", 1);
456 /* Backup previously unanaged file before to be overwritten */
457 file_copy(zFullPath, zOrig);
458 fossil_free(zOrig);
459
--- src/update.c
+++ src/update.c
@@ -448,11 +448,11 @@
448 zOp = "CONFLICT";
449 nc = 1;
450 zErrMsg = "duplicate file";
451 }else if( idt>0 && idv==0 ){
452 /* File added in the target. */
453 if( file_isfile_or_link(zFullPath, RepoFILE) ){
454 /* Name of backup file with Original content */
455 char *zOrig = file_newname(zFullPath, "original", 1);
456 /* Backup previously unanaged file before to be overwritten */
457 file_copy(zFullPath, zOrig);
458 fossil_free(zOrig);
459
+5 -5
--- src/vfile.c
+++ src/vfile.c
@@ -211,11 +211,11 @@
211211
currentPerm = file_perm(zName, RepoFILE);
212212
#endif
213213
if( chnged==0 && (isDeleted || rid==0) ){
214214
/* "fossil rm" or "fossil add" always change the file */
215215
chnged = 1;
216
- }else if( !file_isfile_or_link(0) && currentSize>=0 ){
216
+ }else if( !file_isfile_or_link(0, RepoFILE) && currentSize>=0 ){
217217
if( cksigFlags & CKSIG_ENOTFILE ){
218218
fossil_warning("not an ordinary file: %s", zName);
219219
nErr++;
220220
}
221221
chnged = 1;
@@ -537,13 +537,13 @@
537537
if( !vfile_top_of_checkout(zPath) ){
538538
vfile_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2, eFType);
539539
}
540540
#ifdef _DIRENT_HAVE_D_TYPE
541541
}else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK)
542
- ? (file_isfile_or_link(zPath)) : (pEntry->d_type==DT_REG) ){
542
+ ? (file_isfile_or_link(zPath, eFType)) : (pEntry->d_type==DT_REG) ){
543543
#else
544
- }else if( file_isfile_or_link(zPath) ){
544
+ }else if( file_isfile_or_link(zPath, eFType) ){
545545
#endif
546546
if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){
547547
db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
548548
if( scanFlags & SCAN_MTIME ){
549549
db_bind_int(&ins, ":mtime", file_mtime(zPath, eFType));
@@ -669,13 +669,13 @@
669669
fossil_free(zSavePath);
670670
result += count; /* found X normal files? */
671671
}
672672
#ifdef _DIRENT_HAVE_D_TYPE
673673
}else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK)
674
- ? (file_isfile_or_link(zPath)) : (pEntry->d_type==DT_REG) ){
674
+ ? (file_isfile_or_link(zPath, eFType)) : (pEntry->d_type==DT_REG) ){
675675
#else
676
- }else if( file_isfile_or_link(zPath) ){
676
+ }else if( file_isfile_or_link(zPath, eFType) ){
677677
#endif
678678
db_bind_text(&upd, ":file", zOrigPath);
679679
db_step(&upd);
680680
db_reset(&upd);
681681
result++; /* found 1 normal file */
682682
--- src/vfile.c
+++ src/vfile.c
@@ -211,11 +211,11 @@
211 currentPerm = file_perm(zName, RepoFILE);
212 #endif
213 if( chnged==0 && (isDeleted || rid==0) ){
214 /* "fossil rm" or "fossil add" always change the file */
215 chnged = 1;
216 }else if( !file_isfile_or_link(0) && currentSize>=0 ){
217 if( cksigFlags & CKSIG_ENOTFILE ){
218 fossil_warning("not an ordinary file: %s", zName);
219 nErr++;
220 }
221 chnged = 1;
@@ -537,13 +537,13 @@
537 if( !vfile_top_of_checkout(zPath) ){
538 vfile_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2, eFType);
539 }
540 #ifdef _DIRENT_HAVE_D_TYPE
541 }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK)
542 ? (file_isfile_or_link(zPath)) : (pEntry->d_type==DT_REG) ){
543 #else
544 }else if( file_isfile_or_link(zPath) ){
545 #endif
546 if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){
547 db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
548 if( scanFlags & SCAN_MTIME ){
549 db_bind_int(&ins, ":mtime", file_mtime(zPath, eFType));
@@ -669,13 +669,13 @@
669 fossil_free(zSavePath);
670 result += count; /* found X normal files? */
671 }
672 #ifdef _DIRENT_HAVE_D_TYPE
673 }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK)
674 ? (file_isfile_or_link(zPath)) : (pEntry->d_type==DT_REG) ){
675 #else
676 }else if( file_isfile_or_link(zPath) ){
677 #endif
678 db_bind_text(&upd, ":file", zOrigPath);
679 db_step(&upd);
680 db_reset(&upd);
681 result++; /* found 1 normal file */
682
--- src/vfile.c
+++ src/vfile.c
@@ -211,11 +211,11 @@
211 currentPerm = file_perm(zName, RepoFILE);
212 #endif
213 if( chnged==0 && (isDeleted || rid==0) ){
214 /* "fossil rm" or "fossil add" always change the file */
215 chnged = 1;
216 }else if( !file_isfile_or_link(0, RepoFILE) && currentSize>=0 ){
217 if( cksigFlags & CKSIG_ENOTFILE ){
218 fossil_warning("not an ordinary file: %s", zName);
219 nErr++;
220 }
221 chnged = 1;
@@ -537,13 +537,13 @@
537 if( !vfile_top_of_checkout(zPath) ){
538 vfile_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2, eFType);
539 }
540 #ifdef _DIRENT_HAVE_D_TYPE
541 }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK)
542 ? (file_isfile_or_link(zPath, eFType)) : (pEntry->d_type==DT_REG) ){
543 #else
544 }else if( file_isfile_or_link(zPath, eFType) ){
545 #endif
546 if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){
547 db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
548 if( scanFlags & SCAN_MTIME ){
549 db_bind_int(&ins, ":mtime", file_mtime(zPath, eFType));
@@ -669,13 +669,13 @@
669 fossil_free(zSavePath);
670 result += count; /* found X normal files? */
671 }
672 #ifdef _DIRENT_HAVE_D_TYPE
673 }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK)
674 ? (file_isfile_or_link(zPath, eFType)) : (pEntry->d_type==DT_REG) ){
675 #else
676 }else if( file_isfile_or_link(zPath, eFType) ){
677 #endif
678 db_bind_text(&upd, ":file", zOrigPath);
679 db_step(&upd);
680 db_reset(&upd);
681 result++; /* found 1 normal file */
682

Keyboard Shortcuts

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