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.
Commit
eb2dc8faac5fe97387efb4f9466afbe799ec1a66
Parent
0c7834c77b30469…
2 files changed
+7
-1
+4
-4
+7
-1
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -858,11 +858,17 @@ | ||
| 858 | 858 | continue; |
| 859 | 859 | } |
| 860 | 860 | zUtf8Name = fossil_filename_to_utf8(pEntry->d_name); |
| 861 | 861 | zSubpath = mprintf("%s/%s", zPath, zUtf8Name); |
| 862 | 862 | 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 | + { | |
| 864 | 870 | recon_read_dir(zSubpath); |
| 865 | 871 | }else{ |
| 866 | 872 | blob_init(&path, 0, 0); |
| 867 | 873 | blob_appendf(&path, "%s", zSubpath); |
| 868 | 874 | if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){ |
| 869 | 875 |
| --- 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 @@ | ||
| 604 | 604 | if( glob_match(pIgnore1, &zPath[nPrefix+1]) || |
| 605 | 605 | glob_match(pIgnore2, &zPath[nPrefix+1]) || |
| 606 | 606 | glob_match(pIgnore3, &zPath[nPrefix+1]) ){ |
| 607 | 607 | /* do nothing */ |
| 608 | 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) ){ | |
| 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 | 611 | #else |
| 612 | 612 | }else if( file_wd_isdir(zPath)==1 ){ |
| 613 | 613 | #endif |
| 614 | 614 | if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){ |
| 615 | 615 | char *zSavePath = mprintf("%s", zPath); |
| @@ -621,12 +621,12 @@ | ||
| 621 | 621 | db_reset(&ins); |
| 622 | 622 | fossil_free(zSavePath); |
| 623 | 623 | result += count; /* found X normal files? */ |
| 624 | 624 | } |
| 625 | 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) ){ | |
| 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 | 628 | #else |
| 629 | 629 | }else if( file_wd_isfile_or_link(zPath) ){ |
| 630 | 630 | #endif |
| 631 | 631 | db_bind_text(&upd, ":file", zOrigPath); |
| 632 | 632 | db_step(&upd); |
| 633 | 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) ? (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 |