Fossil SCM

When creating a manifest, get isExe and isLink bits from filesystem at once instead of doing two stat(2) calls.

dmitry 2011-09-29 14:07 trunk
Commit 9bfa186be09f3f95c15f256f4ab9bc9088378f94
1 file changed +11 -10
+11 -10
--- src/checkin.c
+++ src/checkin.c
@@ -658,30 +658,31 @@
658658
while( db_step(&q)==SQLITE_ROW ){
659659
const char *zName = db_column_text(&q, 0);
660660
const char *zUuid = db_column_text(&q, 1);
661661
const char *zOrig = db_column_text(&q, 2);
662662
int frid = db_column_int(&q, 3);
663
- int isexe = db_column_int(&q, 4);
663
+ int isExe = db_column_int(&q, 4);
664664
int isLink = db_column_int(&q, 5);
665665
int isSelected = db_column_int(&q, 6);
666666
const char *zPerm;
667667
int cmp;
668668
#if !defined(_WIN32)
669
- /* For unix, extract the "executable" permission bit directly from
670
- ** the filesystem. On windows, the "executable" bit is retained
669
+ int mPerm;
670
+
671
+ /* For unix, extract the "executable" and "symlink" permissions
672
+ ** directly from the filesystem. On windows, permissions are
671673
** unchanged from the original.
672674
*/
675
+
673676
blob_resize(&filename, nBasename);
674677
blob_append(&filename, zName, -1);
675
- isexe = file_wd_isexe(blob_str(&filename));
676
-
677
- /* For unix, check if the file on the filesystem is symlink.
678
- ** On windows, the bit is retained unchanged from original.
679
- */
680
- isLink = file_wd_islink(blob_str(&filename));
678
+
679
+ mPerm = file_wd_perm(blob_str(&filename));
680
+ isExe = ( mPerm==PERM_EXE );
681
+ isLink = ( mPerm==PERM_LNK );
681682
#endif
682
- if( isexe ){
683
+ if( isExe ){
683684
zPerm = " x";
684685
}else if( isLink ){
685686
zPerm = " l"; /* note: symlinks don't have executable bit on unix */
686687
}else{
687688
zPerm = "";
688689
--- src/checkin.c
+++ src/checkin.c
@@ -658,30 +658,31 @@
658 while( db_step(&q)==SQLITE_ROW ){
659 const char *zName = db_column_text(&q, 0);
660 const char *zUuid = db_column_text(&q, 1);
661 const char *zOrig = db_column_text(&q, 2);
662 int frid = db_column_int(&q, 3);
663 int isexe = db_column_int(&q, 4);
664 int isLink = db_column_int(&q, 5);
665 int isSelected = db_column_int(&q, 6);
666 const char *zPerm;
667 int cmp;
668 #if !defined(_WIN32)
669 /* For unix, extract the "executable" permission bit directly from
670 ** the filesystem. On windows, the "executable" bit is retained
 
 
671 ** unchanged from the original.
672 */
 
673 blob_resize(&filename, nBasename);
674 blob_append(&filename, zName, -1);
675 isexe = file_wd_isexe(blob_str(&filename));
676
677 /* For unix, check if the file on the filesystem is symlink.
678 ** On windows, the bit is retained unchanged from original.
679 */
680 isLink = file_wd_islink(blob_str(&filename));
681 #endif
682 if( isexe ){
683 zPerm = " x";
684 }else if( isLink ){
685 zPerm = " l"; /* note: symlinks don't have executable bit on unix */
686 }else{
687 zPerm = "";
688
--- src/checkin.c
+++ src/checkin.c
@@ -658,30 +658,31 @@
658 while( db_step(&q)==SQLITE_ROW ){
659 const char *zName = db_column_text(&q, 0);
660 const char *zUuid = db_column_text(&q, 1);
661 const char *zOrig = db_column_text(&q, 2);
662 int frid = db_column_int(&q, 3);
663 int isExe = db_column_int(&q, 4);
664 int isLink = db_column_int(&q, 5);
665 int isSelected = db_column_int(&q, 6);
666 const char *zPerm;
667 int cmp;
668 #if !defined(_WIN32)
669 int mPerm;
670
671 /* For unix, extract the "executable" and "symlink" permissions
672 ** directly from the filesystem. On windows, permissions are
673 ** unchanged from the original.
674 */
675
676 blob_resize(&filename, nBasename);
677 blob_append(&filename, zName, -1);
678
679 mPerm = file_wd_perm(blob_str(&filename));
680 isExe = ( mPerm==PERM_EXE );
681 isLink = ( mPerm==PERM_LNK );
 
 
682 #endif
683 if( isExe ){
684 zPerm = " x";
685 }else if( isLink ){
686 zPerm = " l"; /* note: symlinks don't have executable bit on unix */
687 }else{
688 zPerm = "";
689

Keyboard Shortcuts

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