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
9ce4f7da
Commit
9ce4f7da
authored
Sep 04, 2013
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests to use core.filemode correctly
Some windows tests were failing
parent
2a54c7f4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
13 deletions
+20
-13
tests-clar/clar_libgit2.c
+10
-0
tests-clar/clar_libgit2.h
+1
-0
tests-clar/repo/init.c
+9
-13
No files found.
tests-clar/clar_libgit2.c
View file @
9ce4f7da
...
@@ -344,3 +344,13 @@ void cl_repo_set_bool(git_repository *repo, const char *cfg, int value)
...
@@ -344,3 +344,13 @@ void cl_repo_set_bool(git_repository *repo, const char *cfg, int value)
cl_git_pass
(
git_config_set_bool
(
config
,
cfg
,
value
!=
0
));
cl_git_pass
(
git_config_set_bool
(
config
,
cfg
,
value
!=
0
));
git_config_free
(
config
);
git_config_free
(
config
);
}
}
int
cl_repo_get_bool
(
git_repository
*
repo
,
const
char
*
cfg
)
{
int
val
=
0
;
git_config
*
config
;
cl_git_pass
(
git_repository_config
(
&
config
,
repo
));
cl_git_pass
(
git_config_get_bool
(
&
val
,
config
,
cfg
));;
git_config_free
(
config
);
return
val
;
}
tests-clar/clar_libgit2.h
View file @
9ce4f7da
...
@@ -88,5 +88,6 @@ int cl_git_remove_placeholders(const char *directory_path, const char *filename)
...
@@ -88,5 +88,6 @@ int cl_git_remove_placeholders(const char *directory_path, const char *filename)
/* config setting helpers */
/* config setting helpers */
void
cl_repo_set_bool
(
git_repository
*
repo
,
const
char
*
cfg
,
int
value
);
void
cl_repo_set_bool
(
git_repository
*
repo
,
const
char
*
cfg
,
int
value
);
int
cl_repo_get_bool
(
git_repository
*
repo
,
const
char
*
cfg
);
#endif
#endif
tests-clar/repo/init.c
View file @
9ce4f7da
...
@@ -270,7 +270,6 @@ void test_repo_init__reinit_doesnot_overwrite_ignorecase(void)
...
@@ -270,7 +270,6 @@ void test_repo_init__reinit_doesnot_overwrite_ignorecase(void)
void
test_repo_init__reinit_overwrites_filemode
(
void
)
void
test_repo_init__reinit_overwrites_filemode
(
void
)
{
{
git_config
*
config
;
int
expected
,
current_value
;
int
expected
,
current_value
;
#ifdef GIT_WIN32
#ifdef GIT_WIN32
...
@@ -291,13 +290,10 @@ void test_repo_init__reinit_overwrites_filemode(void)
...
@@ -291,13 +290,10 @@ void test_repo_init__reinit_overwrites_filemode(void)
/* Reinit the repository */
/* Reinit the repository */
cl_git_pass
(
git_repository_init
(
&
_repo
,
"overwrite.git"
,
1
));
cl_git_pass
(
git_repository_init
(
&
_repo
,
"overwrite.git"
,
1
));
git_repository_config
(
&
config
,
_repo
);
/* Ensure the "core.filemode" config value has been reset */
/* Ensure the "core.filemode" config value has been reset */
c
l_git_pass
(
git_config_get_bool
(
&
current_value
,
config
,
"core.filemode"
)
);
c
urrent_value
=
cl_repo_get_bool
(
_repo
,
"core.filemode"
);
cl_assert_equal_i
(
expected
,
current_value
);
cl_assert_equal_i
(
expected
,
current_value
);
git_config_free
(
config
);
}
}
void
test_repo_init__sets_logAllRefUpdates_according_to_type_of_repository
(
void
)
void
test_repo_init__sets_logAllRefUpdates_according_to_type_of_repository
(
void
)
...
@@ -391,8 +387,8 @@ static void assert_hooks_match(
...
@@ -391,8 +387,8 @@ static void assert_hooks_match(
(((
expected_st
.
st_mode
&
0111
)
?
0100777
:
0100666
)
&
~
g_umask
);
(((
expected_st
.
st_mode
&
0111
)
?
0100777
:
0100666
)
&
~
g_umask
);
if
(
!
core_filemode
)
{
if
(
!
core_filemode
)
{
expected_st
.
st_mode
=
expected_st
.
st_mode
&
~
01
11
;
expected_st
.
st_mode
=
expected_st
.
st_mode
&
~
01
77
;
st
.
st_mode
=
st
.
st_mode
&
~
01
11
;
st
.
st_mode
=
st
.
st_mode
&
~
01
77
;
}
}
cl_assert_equal_i_fmt
(
expected_st
.
st_mode
,
st
.
st_mode
,
"%07o"
);
cl_assert_equal_i_fmt
(
expected_st
.
st_mode
,
st
.
st_mode
,
"%07o"
);
...
@@ -438,6 +434,7 @@ void test_repo_init__extended_with_template(void)
...
@@ -438,6 +434,7 @@ void test_repo_init__extended_with_template(void)
git_buf
expected
=
GIT_BUF_INIT
;
git_buf
expected
=
GIT_BUF_INIT
;
git_buf
actual
=
GIT_BUF_INIT
;
git_buf
actual
=
GIT_BUF_INIT
;
git_repository_init_options
opts
=
GIT_REPOSITORY_INIT_OPTIONS_INIT
;
git_repository_init_options
opts
=
GIT_REPOSITORY_INIT_OPTIONS_INIT
;
int
filemode
;
cl_set_cleanup
(
&
cleanup_repository
,
"templated.git"
);
cl_set_cleanup
(
&
cleanup_repository
,
"templated.git"
);
...
@@ -461,13 +458,15 @@ void test_repo_init__extended_with_template(void)
...
@@ -461,13 +458,15 @@ void test_repo_init__extended_with_template(void)
git_buf_free
(
&
expected
);
git_buf_free
(
&
expected
);
git_buf_free
(
&
actual
);
git_buf_free
(
&
actual
);
filemode
=
cl_repo_get_bool
(
_repo
,
"core.filemode"
);
assert_hooks_match
(
assert_hooks_match
(
cl_fixture
(
"template"
),
git_repository_path
(
_repo
),
cl_fixture
(
"template"
),
git_repository_path
(
_repo
),
"hooks/update.sample"
,
tru
e
);
"hooks/update.sample"
,
filemod
e
);
assert_hooks_match
(
assert_hooks_match
(
cl_fixture
(
"template"
),
git_repository_path
(
_repo
),
cl_fixture
(
"template"
),
git_repository_path
(
_repo
),
"hooks/link.sample"
,
tru
e
);
"hooks/link.sample"
,
filemod
e
);
}
}
void
test_repo_init__extended_with_template_and_shared_mode
(
void
)
void
test_repo_init__extended_with_template_and_shared_mode
(
void
)
...
@@ -475,7 +474,6 @@ void test_repo_init__extended_with_template_and_shared_mode(void)
...
@@ -475,7 +474,6 @@ void test_repo_init__extended_with_template_and_shared_mode(void)
git_buf
expected
=
GIT_BUF_INIT
;
git_buf
expected
=
GIT_BUF_INIT
;
git_buf
actual
=
GIT_BUF_INIT
;
git_buf
actual
=
GIT_BUF_INIT
;
git_repository_init_options
opts
=
GIT_REPOSITORY_INIT_OPTIONS_INIT
;
git_repository_init_options
opts
=
GIT_REPOSITORY_INIT_OPTIONS_INIT
;
git_config
*
config
;
int
filemode
=
true
;
int
filemode
=
true
;
const
char
*
repo_path
=
NULL
;
const
char
*
repo_path
=
NULL
;
...
@@ -491,9 +489,7 @@ void test_repo_init__extended_with_template_and_shared_mode(void)
...
@@ -491,9 +489,7 @@ void test_repo_init__extended_with_template_and_shared_mode(void)
cl_assert
(
!
git_repository_is_bare
(
_repo
));
cl_assert
(
!
git_repository_is_bare
(
_repo
));
cl_assert
(
!
git__suffixcmp
(
git_repository_path
(
_repo
),
"/init_shared_from_tpl/.git/"
));
cl_assert
(
!
git__suffixcmp
(
git_repository_path
(
_repo
),
"/init_shared_from_tpl/.git/"
));
cl_git_pass
(
git_repository_config
(
&
config
,
_repo
));
filemode
=
cl_repo_get_bool
(
_repo
,
"core.filemode"
);
cl_git_pass
(
git_config_get_bool
(
&
filemode
,
config
,
"core.filemode"
));
git_config_free
(
config
);
cl_git_pass
(
git_futils_readbuffer
(
cl_git_pass
(
git_futils_readbuffer
(
&
expected
,
cl_fixture
(
"template/description"
)));
&
expected
,
cl_fixture
(
"template/description"
)));
...
...
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