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
89ee31a8
Commit
89ee31a8
authored
Apr 05, 2020
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refspec: use GIT_ASSERT
parent
7f0cabd1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
9 deletions
+18
-9
src/refspec.c
+18
-9
No files found.
src/refspec.c
View file @
89ee31a8
...
...
@@ -24,7 +24,8 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
int
valid
=
0
;
unsigned
int
flags
;
assert
(
refspec
&&
input
);
GIT_ASSERT_ARG
(
refspec
);
GIT_ASSERT_ARG
(
input
);
memset
(
refspec
,
0x0
,
sizeof
(
git_refspec
));
refspec
->
push
=
!
is_fetch
;
...
...
@@ -180,7 +181,8 @@ void git_refspec__dispose(git_refspec *refspec)
int
git_refspec_parse
(
git_refspec
**
out_refspec
,
const
char
*
input
,
int
is_fetch
)
{
git_refspec
*
refspec
;
assert
(
out_refspec
&&
input
);
GIT_ASSERT_ARG
(
out_refspec
);
GIT_ASSERT_ARG
(
input
);
*
out_refspec
=
NULL
;
...
...
@@ -219,7 +221,7 @@ const char *git_refspec_string(const git_refspec *refspec)
int
git_refspec_force
(
const
git_refspec
*
refspec
)
{
assert
(
refspec
);
GIT_ASSERT_ARG
(
refspec
);
return
refspec
->
force
;
}
...
...
@@ -261,7 +263,7 @@ static int refspec_transform(
from_star
=
strchr
(
from
,
'*'
);
to_star
=
strchr
(
to
,
'*'
);
assert
(
from_star
&&
to_star
);
GIT_ASSERT
(
from_star
&&
to_star
);
/* star offset, both in 'from' and in 'name' */
star_offset
=
from_star
-
from
;
...
...
@@ -283,7 +285,9 @@ int git_refspec_transform(git_buf *out, const git_refspec *spec, const char *nam
{
int
error
;
assert
(
out
&&
spec
&&
name
);
GIT_ASSERT_ARG
(
out
);
GIT_ASSERT_ARG
(
spec
);
GIT_ASSERT_ARG
(
name
);
if
((
error
=
git_buf_sanitize
(
out
))
<
0
)
return
error
;
...
...
@@ -303,7 +307,9 @@ int git_refspec_rtransform(git_buf *out, const git_refspec *spec, const char *na
{
int
error
;
assert
(
out
&&
spec
&&
name
);
GIT_ASSERT_ARG
(
out
);
GIT_ASSERT_ARG
(
spec
);
GIT_ASSERT_ARG
(
name
);
if
((
error
=
git_buf_sanitize
(
out
))
<
0
)
return
error
;
...
...
@@ -333,14 +339,15 @@ int git_refspec__serialize(git_buf *out, const git_refspec *refspec)
int
git_refspec_is_wildcard
(
const
git_refspec
*
spec
)
{
assert
(
spec
&&
spec
->
src
);
GIT_ASSERT_ARG
(
spec
);
GIT_ASSERT_ARG
(
spec
->
src
);
return
(
spec
->
src
[
strlen
(
spec
->
src
)
-
1
]
==
'*'
);
}
git_direction
git_refspec_direction
(
const
git_refspec
*
spec
)
{
assert
(
spec
);
GIT_ASSERT_ARG
(
spec
);
return
spec
->
push
;
}
...
...
@@ -359,7 +366,9 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
NULL
};
assert
(
out
&&
spec
&&
refs
);
GIT_ASSERT_ARG
(
out
);
GIT_ASSERT_ARG
(
spec
);
GIT_ASSERT_ARG
(
refs
);
cur
=
git__calloc
(
1
,
sizeof
(
git_refspec
));
GIT_ERROR_CHECK_ALLOC
(
cur
);
...
...
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