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
939d8d57
Commit
939d8d57
authored
Mar 17, 2018
by
Nika Layzell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mailmap: Support path fixtures in cl_git_repository_init()
parent
b88cbf8c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
17 deletions
+23
-17
tests/clar.h
+1
-0
tests/clar/fixtures.h
+13
-14
tests/clar_libgit2.c
+9
-3
No files found.
tests/clar.h
View file @
939d8d57
...
...
@@ -72,6 +72,7 @@ void cl_trace_register(cl_trace_cb *cb, void *payload);
const
char
*
cl_fixture
(
const
char
*
fixture_name
);
void
cl_fixture_sandbox
(
const
char
*
fixture_name
);
void
cl_fixture_cleanup
(
const
char
*
fixture_name
);
const
char
*
cl_fixture_basename
(
const
char
*
fixture_name
);
#endif
/**
...
...
tests/clar/fixtures.h
View file @
939d8d57
...
...
@@ -20,19 +20,6 @@ fixture_path(const char *base, const char *fixture_name)
return
_path
;
}
static
const
char
*
fixture_basename
(
const
char
*
fixture_name
)
{
const
char
*
p
;
for
(
p
=
fixture_name
;
*
p
;
p
++
)
{
if
(
p
[
0
]
==
'/'
&&
p
[
1
]
&&
p
[
1
]
!=
'/'
)
fixture_name
=
p
+
1
;
}
return
fixture_name
;
}
#ifdef CLAR_FIXTURE_PATH
const
char
*
cl_fixture
(
const
char
*
fixture_name
)
{
...
...
@@ -44,8 +31,20 @@ void cl_fixture_sandbox(const char *fixture_name)
fs_copy
(
cl_fixture
(
fixture_name
),
_clar_path
);
}
const
char
*
cl_fixture_basename
(
const
char
*
fixture_name
)
{
const
char
*
p
;
for
(
p
=
fixture_name
;
*
p
;
p
++
)
{
if
(
p
[
0
]
==
'/'
&&
p
[
1
]
&&
p
[
1
]
!=
'/'
)
fixture_name
=
p
+
1
;
}
return
fixture_name
;
}
void
cl_fixture_cleanup
(
const
char
*
fixture_name
)
{
fs_rm
(
fixture_path
(
_clar_path
,
fixture_basename
(
fixture_name
)));
fs_rm
(
fixture_path
(
_clar_path
,
cl_
fixture_basename
(
fixture_name
)));
}
#endif
tests/clar_libgit2.c
View file @
939d8d57
...
...
@@ -171,13 +171,17 @@ static git_repository *_cl_repo = NULL;
git_repository
*
cl_git_sandbox_init
(
const
char
*
sandbox
)
{
/* Get the name of the sandbox folder which will be created
*/
const
char
*
basename
=
cl_fixture_basename
(
sandbox
);
/* Copy the whole sandbox folder from our fixtures to our test sandbox
* area. After this it can be accessed with `./sandbox`
*/
cl_fixture_sandbox
(
sandbox
);
_cl_sandbox
=
sandbox
;
cl_git_pass
(
p_chdir
(
sandbox
));
cl_git_pass
(
p_chdir
(
basename
));
/* If this is not a bare repo, then rename `sandbox/.gitted` to
* `sandbox/.git` which must be done since we cannot store a folder
...
...
@@ -200,7 +204,7 @@ git_repository *cl_git_sandbox_init(const char *sandbox)
cl_git_pass
(
p_chdir
(
".."
));
/* Now open the sandbox repository and make it available for tests */
cl_git_pass
(
git_repository_open
(
&
_cl_repo
,
sandbox
));
cl_git_pass
(
git_repository_open
(
&
_cl_repo
,
basename
));
/* Adjust configs after copying to new filesystem */
cl_git_pass
(
git_repository_reinit_filesystem
(
_cl_repo
,
0
));
...
...
@@ -222,7 +226,9 @@ git_repository *cl_git_sandbox_reopen(void)
git_repository_free
(
_cl_repo
);
_cl_repo
=
NULL
;
cl_git_pass
(
git_repository_open
(
&
_cl_repo
,
_cl_sandbox
));
cl_git_pass
(
git_repository_open
(
&
_cl_repo
,
cl_fixture_basename
(
_cl_sandbox
)));
}
return
_cl_repo
;
...
...
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