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
0165e885
Commit
0165e885
authored
Apr 05, 2020
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
worktree: use GIT_ASSERT
parent
64e2b6ef
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
11 deletions
+19
-11
src/worktree.c
+19
-11
No files found.
src/worktree.c
View file @
0165e885
...
...
@@ -37,7 +37,8 @@ int git_worktree_list(git_strarray *wts, git_repository *repo)
size_t
i
,
len
;
int
error
;
assert
(
wts
&&
repo
);
GIT_ASSERT_ARG
(
wts
);
GIT_ASSERT_ARG
(
repo
);
wts
->
count
=
0
;
wts
->
strings
=
NULL
;
...
...
@@ -73,7 +74,8 @@ char *git_worktree__read_link(const char *base, const char *file)
{
git_buf
path
=
GIT_BUF_INIT
,
buf
=
GIT_BUF_INIT
;
assert
(
base
&&
file
);
GIT_ASSERT_ARG_WITH_RETVAL
(
base
,
NULL
);
GIT_ASSERT_ARG_WITH_RETVAL
(
file
,
NULL
);
if
(
git_buf_joinpath
(
&
path
,
base
,
file
)
<
0
)
goto
err
;
...
...
@@ -106,7 +108,9 @@ static int write_wtfile(const char *base, const char *file, const git_buf *buf)
git_buf
path
=
GIT_BUF_INIT
;
int
err
;
assert
(
base
&&
file
&&
buf
);
GIT_ASSERT_ARG
(
base
);
GIT_ASSERT_ARG
(
file
);
GIT_ASSERT_ARG
(
buf
);
if
((
err
=
git_buf_joinpath
(
&
path
,
base
,
file
))
<
0
)
goto
out
;
...
...
@@ -170,7 +174,8 @@ int git_worktree_lookup(git_worktree **out, git_repository *repo, const char *na
git_worktree
*
wt
=
NULL
;
int
error
;
assert
(
repo
&&
name
);
GIT_ASSERT_ARG
(
repo
);
GIT_ASSERT_ARG
(
name
);
*
out
=
NULL
;
...
...
@@ -237,7 +242,7 @@ void git_worktree_free(git_worktree *wt)
int
git_worktree_validate
(
const
git_worktree
*
wt
)
{
assert
(
wt
);
GIT_ASSERT_ARG
(
wt
);
if
(
!
is_worktree_dir
(
wt
->
gitdir_path
))
{
git_error_set
(
GIT_ERROR_WORKTREE
,
...
...
@@ -304,7 +309,10 @@ int git_worktree_add(git_worktree **out, git_repository *repo,
if
(
opts
)
memcpy
(
&
wtopts
,
opts
,
sizeof
(
wtopts
));
assert
(
out
&&
repo
&&
name
&&
worktree
);
GIT_ASSERT_ARG
(
out
);
GIT_ASSERT_ARG
(
repo
);
GIT_ASSERT_ARG
(
name
);
GIT_ASSERT_ARG
(
worktree
);
*
out
=
NULL
;
...
...
@@ -417,7 +425,7 @@ int git_worktree_lock(git_worktree *wt, const char *reason)
git_buf
buf
=
GIT_BUF_INIT
,
path
=
GIT_BUF_INIT
;
int
error
;
assert
(
wt
);
GIT_ASSERT_ARG
(
wt
);
if
((
error
=
git_worktree_is_locked
(
NULL
,
wt
))
<
0
)
goto
out
;
...
...
@@ -448,7 +456,7 @@ int git_worktree_unlock(git_worktree *wt)
git_buf
path
=
GIT_BUF_INIT
;
int
error
;
assert
(
wt
);
GIT_ASSERT_ARG
(
wt
);
if
((
error
=
git_worktree_is_locked
(
NULL
,
wt
))
<
0
)
return
error
;
...
...
@@ -475,7 +483,7 @@ int git_worktree_is_locked(git_buf *reason, const git_worktree *wt)
git_buf
path
=
GIT_BUF_INIT
;
int
error
,
locked
;
assert
(
wt
);
GIT_ASSERT_ARG
(
wt
);
if
(
reason
)
git_buf_clear
(
reason
);
...
...
@@ -496,13 +504,13 @@ out:
const
char
*
git_worktree_name
(
const
git_worktree
*
wt
)
{
assert
(
wt
);
GIT_ASSERT_ARG_WITH_RETVAL
(
wt
,
NULL
);
return
wt
->
name
;
}
const
char
*
git_worktree_path
(
const
git_worktree
*
wt
)
{
assert
(
wt
);
GIT_ASSERT_ARG_WITH_RETVAL
(
wt
,
NULL
);
return
wt
->
worktree_path
;
}
...
...
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