| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -257,7 +257,7 @@ extern int git_futils_truncate(const char *path, int mode); | |||
| 257 | 257 | */ | |
| 258 | 258 | extern int git_futils_filesize(uint64_t *out, git_file fd); | |
| 259 | 259 | ||
| 260 | - #define GIT_PERMS_IS_EXEC(MODE) (((MODE) & 0111) != 0) | ||
| 260 | + #define GIT_PERMS_IS_EXEC(MODE) (((MODE) & 0100) != 0) | ||
| 261 | 261 | #define GIT_PERMS_CANONICAL(MODE) (GIT_PERMS_IS_EXEC(MODE) ? 0755 : 0644) | |
| 262 | 262 | #define GIT_PERMS_FOR_WRITE(MODE) (GIT_PERMS_IS_EXEC(MODE) ? 0777 : 0666) | |
| 263 | 263 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -605,6 +605,45 @@ void test_status_worktree__filemode_changes(void) | |||
| 605 | 605 | cl_assert_equal_i(0, counts.wrong_sorted_path); | |
| 606 | 606 | } | |
| 607 | 607 | ||
| 608 | + void test_status_worktree__filemode_non755(void) | ||
| 609 | + { | ||
| 610 | + git_repository *repo = cl_git_sandbox_init("filemodes"); | ||
| 611 | + status_entry_counts counts; | ||
| 612 | + git_status_options opts = GIT_STATUS_OPTIONS_INIT; | ||
| 613 | + git_buf executable_path = GIT_BUF_INIT; | ||
| 614 | + git_buf nonexecutable_path = GIT_BUF_INIT; | ||
| 615 | + | ||
| 616 | + if (!cl_is_chmod_supported()) | ||
| 617 | + return; | ||
| 618 | + | ||
| 619 | + opts.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED | | ||
| 620 | + GIT_STATUS_OPT_INCLUDE_IGNORED | | ||
| 621 | + GIT_STATUS_OPT_INCLUDE_UNMODIFIED; | ||
| 622 | + | ||
| 623 | + git_buf_joinpath(&executable_path, git_repository_workdir(repo), "exec_on"); | ||
| 624 | + cl_must_pass(p_chmod(git_buf_cstr(&executable_path), 0744)); | ||
| 625 | + git_buf_dispose(&executable_path); | ||
| 626 | + | ||
| 627 | + git_buf_joinpath(&nonexecutable_path, git_repository_workdir(repo), "exec_off"); | ||
| 628 | + | ||
| 629 | + cl_must_pass(p_chmod(git_buf_cstr(&nonexecutable_path), 0655)); | ||
| 630 | + git_buf_dispose(&nonexecutable_path); | ||
| 631 | + | ||
| 632 | + memset(&counts, 0, sizeof(counts)); | ||
| 633 | + counts.expected_entry_count = filemode_count; | ||
| 634 | + counts.expected_paths = filemode_paths; | ||
| 635 | + counts.expected_statuses = filemode_statuses; | ||
| 636 | + | ||
| 637 | + cl_git_pass( | ||
| 638 | + git_status_foreach_ext(repo, &opts, cb_status__normal, &counts) | ||
| 639 | + ); | ||
| 640 | + | ||
| 641 | + cl_assert_equal_i(counts.expected_entry_count, counts.entry_count); | ||
| 642 | + cl_assert_equal_i(0, counts.wrong_status_flags_count); | ||
| 643 | + cl_assert_equal_i(0, counts.wrong_sorted_path); | ||
| 644 | + } | ||
| 645 | + | ||
| 646 | + | ||
| 608 | 647 | static int cb_status__interrupt(const char *p, unsigned int s, void *payload) | |
| 609 | 648 | { | |
| 610 | 649 | volatile int *count = (int *)payload; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments