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
f60ebfcb
Commit
f60ebfcb
authored
Apr 04, 2020
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
annotated_commit: use GIT_ASSERT
parent
b8cdc9c9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
src/annotated_commit.c
+21
-9
No files found.
src/annotated_commit.c
View file @
f60ebfcb
...
@@ -26,7 +26,8 @@ static int annotated_commit_init(
...
@@ -26,7 +26,8 @@ static int annotated_commit_init(
git_annotated_commit
*
annotated_commit
;
git_annotated_commit
*
annotated_commit
;
int
error
=
0
;
int
error
=
0
;
assert
(
out
&&
commit
);
GIT_ASSERT_ARG
(
out
);
GIT_ASSERT_ARG
(
commit
);
*
out
=
NULL
;
*
out
=
NULL
;
...
@@ -63,7 +64,9 @@ static int annotated_commit_init_from_id(
...
@@ -63,7 +64,9 @@ static int annotated_commit_init_from_id(
git_commit
*
commit
=
NULL
;
git_commit
*
commit
=
NULL
;
int
error
=
0
;
int
error
=
0
;
assert
(
out
&&
repo
&&
id
);
GIT_ASSERT_ARG
(
out
);
GIT_ASSERT_ARG
(
repo
);
GIT_ASSERT_ARG
(
id
);
*
out
=
NULL
;
*
out
=
NULL
;
...
@@ -100,7 +103,9 @@ int git_annotated_commit_from_revspec(
...
@@ -100,7 +103,9 @@ int git_annotated_commit_from_revspec(
git_object
*
obj
,
*
commit
;
git_object
*
obj
,
*
commit
;
int
error
;
int
error
;
assert
(
out
&&
repo
&&
revspec
);
GIT_ASSERT_ARG
(
out
);
GIT_ASSERT_ARG
(
repo
);
GIT_ASSERT_ARG
(
revspec
);
if
((
error
=
git_revparse_single
(
&
obj
,
repo
,
revspec
))
<
0
)
if
((
error
=
git_revparse_single
(
&
obj
,
repo
,
revspec
))
<
0
)
return
error
;
return
error
;
...
@@ -126,7 +131,9 @@ int git_annotated_commit_from_ref(
...
@@ -126,7 +131,9 @@ int git_annotated_commit_from_ref(
git_object
*
peeled
;
git_object
*
peeled
;
int
error
=
0
;
int
error
=
0
;
assert
(
out
&&
repo
&&
ref
);
GIT_ASSERT_ARG
(
out
);
GIT_ASSERT_ARG
(
repo
);
GIT_ASSERT_ARG
(
ref
);
*
out
=
NULL
;
*
out
=
NULL
;
...
@@ -154,11 +161,12 @@ int git_annotated_commit_from_head(
...
@@ -154,11 +161,12 @@ int git_annotated_commit_from_head(
git_reference
*
head
;
git_reference
*
head
;
int
error
;
int
error
;
assert
(
out
&&
repo
);
GIT_ASSERT_ARG
(
out
);
GIT_ASSERT_ARG
(
repo
);
*
out
=
NULL
;
*
out
=
NULL
;
if
((
error
=
git_reference_lookup
(
&
head
,
repo
,
GIT_HEAD_FILE
))
<
0
)
if
((
error
=
git_reference_lookup
(
&
head
,
repo
,
GIT_HEAD_FILE
))
<
0
)
return
-
1
;
return
-
1
;
error
=
git_annotated_commit_from_ref
(
out
,
repo
,
head
);
error
=
git_annotated_commit_from_ref
(
out
,
repo
,
head
);
...
@@ -174,7 +182,11 @@ int git_annotated_commit_from_fetchhead(
...
@@ -174,7 +182,11 @@ int git_annotated_commit_from_fetchhead(
const
char
*
remote_url
,
const
char
*
remote_url
,
const
git_oid
*
id
)
const
git_oid
*
id
)
{
{
assert
(
repo
&&
id
&&
branch_name
&&
remote_url
);
GIT_ASSERT_ARG
(
out
);
GIT_ASSERT_ARG
(
repo
);
GIT_ASSERT_ARG
(
branch_name
);
GIT_ASSERT_ARG
(
remote_url
);
GIT_ASSERT_ARG
(
id
);
if
(
annotated_commit_init_from_id
(
out
,
repo
,
id
,
branch_name
)
<
0
)
if
(
annotated_commit_init_from_id
(
out
,
repo
,
id
,
branch_name
)
<
0
)
return
-
1
;
return
-
1
;
...
@@ -192,14 +204,14 @@ int git_annotated_commit_from_fetchhead(
...
@@ -192,14 +204,14 @@ int git_annotated_commit_from_fetchhead(
const
git_oid
*
git_annotated_commit_id
(
const
git_oid
*
git_annotated_commit_id
(
const
git_annotated_commit
*
annotated_commit
)
const
git_annotated_commit
*
annotated_commit
)
{
{
assert
(
annotated_commit
);
GIT_ASSERT_ARG_WITH_RETVAL
(
annotated_commit
,
NULL
);
return
git_commit_id
(
annotated_commit
->
commit
);
return
git_commit_id
(
annotated_commit
->
commit
);
}
}
const
char
*
git_annotated_commit_ref
(
const
char
*
git_annotated_commit_ref
(
const
git_annotated_commit
*
annotated_commit
)
const
git_annotated_commit
*
annotated_commit
)
{
{
assert
(
annotated_commit
);
GIT_ASSERT_ARG_WITH_RETVAL
(
annotated_commit
,
NULL
);
return
annotated_commit
->
ref_name
;
return
annotated_commit
->
ref_name
;
}
}
...
...
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