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
6f6dd17c
Commit
6f6dd17c
authored
Nov 08, 2016
by
Patrick Steinhardt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
worktree: test creating and opening submodule worktrees
parent
1fd6e035
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
tests/worktree/worktree.c
+28
-0
No files found.
tests/worktree/worktree.c
View file @
6f6dd17c
#include "clar_libgit2.h"
#include "worktree_helpers.h"
#include "submodule/submodule_helpers.h"
#include "checkout.h"
#include "repository.h"
...
...
@@ -289,6 +290,33 @@ void test_worktree_worktree__init_existing_path(void)
git_buf_free
(
&
path
);
}
void
test_worktree_worktree__init_submodule
(
void
)
{
git_repository
*
repo
,
*
sm
,
*
wt
;
git_worktree
*
worktree
;
git_buf
path
=
GIT_BUF_INIT
;
cleanup_fixture_worktree
(
&
fixture
);
repo
=
setup_fixture_submod2
();
cl_git_pass
(
git_buf_joinpath
(
&
path
,
repo
->
workdir
,
"sm_unchanged"
));
cl_git_pass
(
git_repository_open
(
&
sm
,
path
.
ptr
));
cl_git_pass
(
git_buf_joinpath
(
&
path
,
repo
->
workdir
,
"../worktree/"
));
cl_git_pass
(
git_worktree_add
(
&
worktree
,
sm
,
"repo-worktree"
,
path
.
ptr
));
cl_git_pass
(
git_repository_open_from_worktree
(
&
wt
,
worktree
));
cl_assert_equal_s
(
path
.
ptr
,
wt
->
workdir
);
cl_assert_equal_s
(
sm
->
commondir
,
wt
->
commondir
);
cl_git_pass
(
git_buf_joinpath
(
&
path
,
sm
->
gitdir
,
"worktrees/repo-worktree/"
));
cl_assert_equal_s
(
path
.
ptr
,
wt
->
gitdir
);
git_buf_free
(
&
path
);
git_worktree_free
(
worktree
);
git_repository_free
(
sm
);
git_repository_free
(
wt
);
}
void
test_worktree_worktree__validate
(
void
)
{
git_worktree
*
wt
;
...
...
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