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
c62c6379
Commit
c62c6379
authored
Apr 20, 2018
by
Etienne Samson
Committed by
Patrick Steinhardt
Oct 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
worktree: a worktree can be made from a bare repository
parent
a7fbb051
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletions
+21
-1
src/worktree.c
+1
-1
tests/worktree/worktree.c
+20
-0
No files found.
src/worktree.c
View file @
c62c6379
...
...
@@ -139,7 +139,7 @@ static int open_worktree_dir(git_worktree **out, const char *parent, const char
if
((
wt
->
name
=
git__strdup
(
name
))
==
NULL
||
(
wt
->
commondir_path
=
git_worktree__read_link
(
dir
,
"commondir"
))
==
NULL
||
(
wt
->
gitlink_path
=
git_worktree__read_link
(
dir
,
"gitdir"
))
==
NULL
||
(
wt
->
parent_path
=
git__strdup
(
parent
))
==
NULL
)
{
||
(
parent
&&
(
wt
->
parent_path
=
git__strdup
(
parent
))
==
NULL
)
)
{
error
=
-
1
;
goto
out
;
}
...
...
tests/worktree/worktree.c
View file @
c62c6379
...
...
@@ -228,6 +228,26 @@ void test_worktree_worktree__init(void)
git_repository_free
(
repo
);
}
void
test_worktree_worktree__add_from_bare
(
void
)
{
git_worktree
*
wt
;
git_repository
*
repo
,
*
wtrepo
;
repo
=
cl_git_sandbox_init
(
"short_tag.git"
);
cl_assert_equal_i
(
1
,
git_repository_is_bare
(
repo
));
cl_assert_equal_i
(
0
,
git_repository_is_worktree
(
repo
));
cl_git_pass
(
git_worktree_add
(
&
wt
,
repo
,
"worktree-frombare"
,
"worktree-frombare"
,
NULL
));
cl_git_pass
(
git_repository_open
(
&
wtrepo
,
"worktree-frombare"
));
cl_assert_equal_i
(
0
,
git_repository_is_bare
(
wtrepo
));
cl_assert_equal_i
(
1
,
git_repository_is_worktree
(
wtrepo
));
git_worktree_free
(
wt
);
git_repository_free
(
repo
);
git_repository_free
(
wtrepo
);
}
void
test_worktree_worktree__add_locked
(
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