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
09a03995
Commit
09a03995
authored
Jul 17, 2012
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Checkout: make core.symlinks test work on OSX.
parent
8651c10f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
tests-clar/checkout/checkout.c
+12
-4
No files found.
tests-clar/checkout/checkout.c
View file @
09a03995
...
@@ -28,8 +28,10 @@ static void test_file_contents(const char *path, const char *expectedcontents)
...
@@ -28,8 +28,10 @@ static void test_file_contents(const char *path, const char *expectedcontents)
{
{
int
fd
;
int
fd
;
char
buffer
[
1024
]
=
{
0
};
char
buffer
[
1024
]
=
{
0
};
fd
=
p_open
(
path
,
O_RDONLY
);
fd
=
p_open
(
path
,
O_RDONLY
);
cl_assert
(
fd
>=
0
);
cl_assert
(
fd
>=
0
);
cl_assert_equal_i
(
p_read
(
fd
,
buffer
,
1024
),
strlen
(
expectedcontents
));
cl_assert_equal_i
(
p_read
(
fd
,
buffer
,
1024
),
strlen
(
expectedcontents
));
cl_assert_equal_s
(
expectedcontents
,
buffer
);
cl_assert_equal_s
(
expectedcontents
,
buffer
);
cl_git_pass
(
p_close
(
fd
));
cl_git_pass
(
p_close
(
fd
));
...
@@ -70,14 +72,18 @@ void test_checkout_checkout__stats(void)
...
@@ -70,14 +72,18 @@ void test_checkout_checkout__stats(void)
/* TODO */
/* TODO */
}
}
void
test_checkout_checkout__symlinks
(
void
)
static
void
enable_symlinks
(
bool
enable
)
{
{
git_config
*
cfg
;
git_config
*
cfg
;
cl_git_pass
(
git_repository_config
(
&
cfg
,
g_repo
));
cl_git_pass
(
git_repository_config
(
&
cfg
,
g_repo
));
cl_git_pass
(
git_config_set_bool
(
cfg
,
"core.symlinks"
,
enable
));
git_config_free
(
cfg
);
}
void
test_checkout_checkout__symlinks
(
void
)
{
/* First try with symlinks forced on */
/* First try with symlinks forced on */
cl_git_pass
(
git_config_set_bool
(
cfg
,
"core.symlinks"
,
true
)
);
enable_symlinks
(
true
);
cl_git_pass
(
git_checkout_force
(
g_repo
,
NULL
));
cl_git_pass
(
git_checkout_force
(
g_repo
,
NULL
));
#ifdef GIT_WIN32
#ifdef GIT_WIN32
...
@@ -96,7 +102,9 @@ void test_checkout_checkout__symlinks(void)
...
@@ -96,7 +102,9 @@ void test_checkout_checkout__symlinks(void)
#endif
#endif
/* Now with symlinks forced off */
/* Now with symlinks forced off */
cl_git_pass
(
git_config_set_bool
(
cfg
,
"core.symlinks"
,
false
));
cl_git_sandbox_cleanup
();
g_repo
=
cl_git_sandbox_init
(
"testrepo"
);
enable_symlinks
(
false
);
cl_git_pass
(
git_checkout_force
(
g_repo
,
NULL
));
cl_git_pass
(
git_checkout_force
(
g_repo
,
NULL
));
test_file_contents
(
"./testrepo/link_to_new.txt"
,
"new.txt"
);
test_file_contents
(
"./testrepo/link_to_new.txt"
,
"new.txt"
);
...
...
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