Fossil SCM
When creating a manifest, get isExe and isLink bits from filesystem at once instead of doing two stat(2) calls.
Commit
9bfa186be09f3f95c15f256f4ab9bc9088378f94
Parent
13a771ce18b3ff2…
1 file changed
+11
-10
+11
-10
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -658,30 +658,31 @@ | ||
| 658 | 658 | while( db_step(&q)==SQLITE_ROW ){ |
| 659 | 659 | const char *zName = db_column_text(&q, 0); |
| 660 | 660 | const char *zUuid = db_column_text(&q, 1); |
| 661 | 661 | const char *zOrig = db_column_text(&q, 2); |
| 662 | 662 | int frid = db_column_int(&q, 3); |
| 663 | - int isexe = db_column_int(&q, 4); | |
| 663 | + int isExe = db_column_int(&q, 4); | |
| 664 | 664 | int isLink = db_column_int(&q, 5); |
| 665 | 665 | int isSelected = db_column_int(&q, 6); |
| 666 | 666 | const char *zPerm; |
| 667 | 667 | int cmp; |
| 668 | 668 | #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 | |
| 671 | 673 | ** unchanged from the original. |
| 672 | 674 | */ |
| 675 | + | |
| 673 | 676 | blob_resize(&filename, nBasename); |
| 674 | 677 | 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 ); | |
| 681 | 682 | #endif |
| 682 | - if( isexe ){ | |
| 683 | + if( isExe ){ | |
| 683 | 684 | zPerm = " x"; |
| 684 | 685 | }else if( isLink ){ |
| 685 | 686 | zPerm = " l"; /* note: symlinks don't have executable bit on unix */ |
| 686 | 687 | }else{ |
| 687 | 688 | zPerm = ""; |
| 688 | 689 |
| --- 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 |