Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
6c78fd06
Unverified
Commit
6c78fd06
authored
Jul 02, 2021
by
Edward Thomson
Committed by
GitHub
Jul 02, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5915 from novalis/executable
Consider files executable only if the user can execute them
parents
992f65f7
b0fd4cf8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
1 deletions
+40
-1
src/futils.h
+1
-1
tests/status/worktree.c
+39
-0
No files found.
src/futils.h
View file @
6c78fd06
...
...
@@ -257,7 +257,7 @@ extern int git_futils_truncate(const char *path, int mode);
*/
extern
int
git_futils_filesize
(
uint64_t
*
out
,
git_file
fd
);
#define GIT_PERMS_IS_EXEC(MODE) (((MODE) & 01
11
) != 0)
#define GIT_PERMS_IS_EXEC(MODE) (((MODE) & 01
00
) != 0)
#define GIT_PERMS_CANONICAL(MODE) (GIT_PERMS_IS_EXEC(MODE) ? 0755 : 0644)
#define GIT_PERMS_FOR_WRITE(MODE) (GIT_PERMS_IS_EXEC(MODE) ? 0777 : 0666)
...
...
tests/status/worktree.c
View file @
6c78fd06
...
...
@@ -605,6 +605,45 @@ void test_status_worktree__filemode_changes(void)
cl_assert_equal_i
(
0
,
counts
.
wrong_sorted_path
);
}
void
test_status_worktree__filemode_non755
(
void
)
{
git_repository
*
repo
=
cl_git_sandbox_init
(
"filemodes"
);
status_entry_counts
counts
;
git_status_options
opts
=
GIT_STATUS_OPTIONS_INIT
;
git_buf
executable_path
=
GIT_BUF_INIT
;
git_buf
nonexecutable_path
=
GIT_BUF_INIT
;
if
(
!
cl_is_chmod_supported
())
return
;
opts
.
flags
=
GIT_STATUS_OPT_INCLUDE_UNTRACKED
|
GIT_STATUS_OPT_INCLUDE_IGNORED
|
GIT_STATUS_OPT_INCLUDE_UNMODIFIED
;
git_buf_joinpath
(
&
executable_path
,
git_repository_workdir
(
repo
),
"exec_on"
);
cl_must_pass
(
p_chmod
(
git_buf_cstr
(
&
executable_path
),
0744
));
git_buf_dispose
(
&
executable_path
);
git_buf_joinpath
(
&
nonexecutable_path
,
git_repository_workdir
(
repo
),
"exec_off"
);
cl_must_pass
(
p_chmod
(
git_buf_cstr
(
&
nonexecutable_path
),
0655
));
git_buf_dispose
(
&
nonexecutable_path
);
memset
(
&
counts
,
0
,
sizeof
(
counts
));
counts
.
expected_entry_count
=
filemode_count
;
counts
.
expected_paths
=
filemode_paths
;
counts
.
expected_statuses
=
filemode_statuses
;
cl_git_pass
(
git_status_foreach_ext
(
repo
,
&
opts
,
cb_status__normal
,
&
counts
)
);
cl_assert_equal_i
(
counts
.
expected_entry_count
,
counts
.
entry_count
);
cl_assert_equal_i
(
0
,
counts
.
wrong_status_flags_count
);
cl_assert_equal_i
(
0
,
counts
.
wrong_sorted_path
);
}
static
int
cb_status__interrupt
(
const
char
*
p
,
unsigned
int
s
,
void
*
payload
)
{
volatile
int
*
count
=
(
int
*
)
payload
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment