Fossil SCM

If pEntry->d_type==DT_LNK, then it could be a link to a directory or to a file, so handle that the same as DT_UNKNOWN.

jan.nijtmans 2014-02-24 10:14 UTC use-d-type
Commit eb2dc8faac5fe97387efb4f9466afbe799ec1a66
2 files changed +7 -1 +4 -4
+7 -1
--- src/rebuild.c
+++ src/rebuild.c
@@ -858,11 +858,17 @@
858858
continue;
859859
}
860860
zUtf8Name = fossil_filename_to_utf8(pEntry->d_name);
861861
zSubpath = mprintf("%s/%s", zPath, zUtf8Name);
862862
fossil_filename_free(zUtf8Name);
863
- if( file_isdir(zSubpath)==1 ){
863
+#ifdef XX_DIRENT_HAVE_D_TYPE
864
+ if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK)
865
+ ? (file_isdir(zSubpath)==1) : (pEntry->d_type==DT_DIR) )
866
+#else
867
+ if( file_isdir(zSubpath)==1 )
868
+#endif
869
+ {
864870
recon_read_dir(zSubpath);
865871
}else{
866872
blob_init(&path, 0, 0);
867873
blob_appendf(&path, "%s", zSubpath);
868874
if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){
869875
--- src/rebuild.c
+++ src/rebuild.c
@@ -858,11 +858,17 @@
858 continue;
859 }
860 zUtf8Name = fossil_filename_to_utf8(pEntry->d_name);
861 zSubpath = mprintf("%s/%s", zPath, zUtf8Name);
862 fossil_filename_free(zUtf8Name);
863 if( file_isdir(zSubpath)==1 ){
 
 
 
 
 
 
864 recon_read_dir(zSubpath);
865 }else{
866 blob_init(&path, 0, 0);
867 blob_appendf(&path, "%s", zSubpath);
868 if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){
869
--- src/rebuild.c
+++ src/rebuild.c
@@ -858,11 +858,17 @@
858 continue;
859 }
860 zUtf8Name = fossil_filename_to_utf8(pEntry->d_name);
861 zSubpath = mprintf("%s/%s", zPath, zUtf8Name);
862 fossil_filename_free(zUtf8Name);
863 #ifdef XX_DIRENT_HAVE_D_TYPE
864 if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK)
865 ? (file_isdir(zSubpath)==1) : (pEntry->d_type==DT_DIR) )
866 #else
867 if( file_isdir(zSubpath)==1 )
868 #endif
869 {
870 recon_read_dir(zSubpath);
871 }else{
872 blob_init(&path, 0, 0);
873 blob_appendf(&path, "%s", zSubpath);
874 if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){
875
+4 -4
--- src/vfile.c
+++ src/vfile.c
@@ -604,12 +604,12 @@
604604
if( glob_match(pIgnore1, &zPath[nPrefix+1]) ||
605605
glob_match(pIgnore2, &zPath[nPrefix+1]) ||
606606
glob_match(pIgnore3, &zPath[nPrefix+1]) ){
607607
/* do nothing */
608608
#ifdef _DIRENT_HAVE_D_TYPE
609
- }else if( (pEntry->d_type==DT_UNKNOWN) ? (file_wd_isdir(zPath)==1)
610
- : (pEntry->d_type==DT_DIR) ){
609
+ }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK)
610
+ ? (file_wd_isdir(zPath)==1) : (pEntry->d_type==DT_DIR) ){
611611
#else
612612
}else if( file_wd_isdir(zPath)==1 ){
613613
#endif
614614
if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){
615615
char *zSavePath = mprintf("%s", zPath);
@@ -621,12 +621,12 @@
621621
db_reset(&ins);
622622
fossil_free(zSavePath);
623623
result += count; /* found X normal files? */
624624
}
625625
#ifdef _DIRENT_HAVE_D_TYPE
626
- }else if( (pEntry->d_type==DT_UNKNOWN) ? (file_wd_isfile_or_link(zPath))
627
- : (pEntry->d_type==DT_REG||pEntry->d_type==DT_LNK) ){
626
+ }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK)
627
+ ? (file_wd_isfile_or_link(zPath)) : (pEntry->d_type==DT_REG) ){
628628
#else
629629
}else if( file_wd_isfile_or_link(zPath) ){
630630
#endif
631631
db_bind_text(&upd, ":file", zOrigPath);
632632
db_step(&upd);
633633
--- src/vfile.c
+++ src/vfile.c
@@ -604,12 +604,12 @@
604 if( glob_match(pIgnore1, &zPath[nPrefix+1]) ||
605 glob_match(pIgnore2, &zPath[nPrefix+1]) ||
606 glob_match(pIgnore3, &zPath[nPrefix+1]) ){
607 /* do nothing */
608 #ifdef _DIRENT_HAVE_D_TYPE
609 }else if( (pEntry->d_type==DT_UNKNOWN) ? (file_wd_isdir(zPath)==1)
610 : (pEntry->d_type==DT_DIR) ){
611 #else
612 }else if( file_wd_isdir(zPath)==1 ){
613 #endif
614 if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){
615 char *zSavePath = mprintf("%s", zPath);
@@ -621,12 +621,12 @@
621 db_reset(&ins);
622 fossil_free(zSavePath);
623 result += count; /* found X normal files? */
624 }
625 #ifdef _DIRENT_HAVE_D_TYPE
626 }else if( (pEntry->d_type==DT_UNKNOWN) ? (file_wd_isfile_or_link(zPath))
627 : (pEntry->d_type==DT_REG||pEntry->d_type==DT_LNK) ){
628 #else
629 }else if( file_wd_isfile_or_link(zPath) ){
630 #endif
631 db_bind_text(&upd, ":file", zOrigPath);
632 db_step(&upd);
633
--- src/vfile.c
+++ src/vfile.c
@@ -604,12 +604,12 @@
604 if( glob_match(pIgnore1, &zPath[nPrefix+1]) ||
605 glob_match(pIgnore2, &zPath[nPrefix+1]) ||
606 glob_match(pIgnore3, &zPath[nPrefix+1]) ){
607 /* do nothing */
608 #ifdef _DIRENT_HAVE_D_TYPE
609 }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK)
610 ? (file_wd_isdir(zPath)==1) : (pEntry->d_type==DT_DIR) ){
611 #else
612 }else if( file_wd_isdir(zPath)==1 ){
613 #endif
614 if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){
615 char *zSavePath = mprintf("%s", zPath);
@@ -621,12 +621,12 @@
621 db_reset(&ins);
622 fossil_free(zSavePath);
623 result += count; /* found X normal files? */
624 }
625 #ifdef _DIRENT_HAVE_D_TYPE
626 }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK)
627 ? (file_wd_isfile_or_link(zPath)) : (pEntry->d_type==DT_REG) ){
628 #else
629 }else if( file_wd_isfile_or_link(zPath) ){
630 #endif
631 db_bind_text(&upd, ":file", zOrigPath);
632 db_step(&upd);
633

Keyboard Shortcuts

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