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
10df661b
Commit
10df661b
authored
Sep 29, 2015
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
index: test that add_bypath preserves mode
parent
fc3ef147
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
tests/index/bypath.c
+23
-0
No files found.
tests/index/bypath.c
View file @
10df661b
...
...
@@ -240,3 +240,26 @@ void test_index_bypath__add_honors_existing_case_4(void)
cl_assert_equal_s
(
"just_a_dir/a/b/Z/y/X/foo.txt"
,
entry
->
path
);
}
void
test_index_bypath__add_honors_mode
(
void
)
{
git_index_entry
*
entry
,
new_entry
;
cl_assert
((
entry
=
git_index_get_bypath
(
g_idx
,
"README.txt"
,
0
))
!=
NULL
);
memcpy
(
&
new_entry
,
entry
,
sizeof
(
git_index_entry
));
new_entry
.
path
=
"README.txt"
;
new_entry
.
mode
=
GIT_FILEMODE_BLOB_EXECUTABLE
;
cl_must_pass
(
p_chmod
(
"submod2/README.txt"
,
GIT_FILEMODE_BLOB_EXECUTABLE
));
cl_git_pass
(
git_index_add
(
g_idx
,
&
new_entry
));
cl_git_pass
(
git_index_write
(
g_idx
));
cl_git_rewritefile
(
"submod2/README.txt"
,
"Modified but still executable"
);
cl_git_pass
(
git_index_add_bypath
(
g_idx
,
"README.txt"
));
cl_git_pass
(
git_index_write
(
g_idx
));
cl_assert
((
entry
=
git_index_get_bypath
(
g_idx
,
"README.txt"
,
0
))
!=
NULL
);
cl_assert_equal_i
(
GIT_FILEMODE_BLOB_EXECUTABLE
,
entry
->
mode
);
}
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