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
7d75e1c7
Commit
7d75e1c7
authored
Apr 05, 2020
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reflog: use GIT_ASSERT
parent
98a4f278
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
14 deletions
+19
-14
src/reflog.c
+19
-14
No files found.
src/reflog.c
View file @
7d75e1c7
...
@@ -50,7 +50,9 @@ int git_reflog_read(git_reflog **reflog, git_repository *repo, const char *name
...
@@ -50,7 +50,9 @@ int git_reflog_read(git_reflog **reflog, git_repository *repo, const char *name
git_refdb
*
refdb
;
git_refdb
*
refdb
;
int
error
;
int
error
;
assert
(
reflog
&&
repo
&&
name
);
GIT_ASSERT_ARG
(
reflog
);
GIT_ASSERT_ARG
(
repo
);
GIT_ASSERT_ARG
(
name
);
if
((
error
=
git_repository_refdb__weakptr
(
&
refdb
,
repo
))
<
0
)
if
((
error
=
git_repository_refdb__weakptr
(
&
refdb
,
repo
))
<
0
)
return
error
;
return
error
;
...
@@ -62,7 +64,8 @@ int git_reflog_write(git_reflog *reflog)
...
@@ -62,7 +64,8 @@ int git_reflog_write(git_reflog *reflog)
{
{
git_refdb
*
db
;
git_refdb
*
db
;
assert
(
reflog
&&
reflog
->
db
);
GIT_ASSERT_ARG
(
reflog
);
GIT_ASSERT_ARG
(
reflog
->
db
);
db
=
reflog
->
db
;
db
=
reflog
->
db
;
return
db
->
backend
->
reflog_write
(
db
->
backend
,
reflog
);
return
db
->
backend
->
reflog_write
(
db
->
backend
,
reflog
);
...
@@ -73,7 +76,9 @@ int git_reflog_append(git_reflog *reflog, const git_oid *new_oid, const git_sign
...
@@ -73,7 +76,9 @@ int git_reflog_append(git_reflog *reflog, const git_oid *new_oid, const git_sign
const
git_reflog_entry
*
previous
;
const
git_reflog_entry
*
previous
;
git_reflog_entry
*
entry
;
git_reflog_entry
*
entry
;
assert
(
reflog
&&
new_oid
&&
committer
);
GIT_ASSERT_ARG
(
reflog
);
GIT_ASSERT_ARG
(
new_oid
);
GIT_ASSERT_ARG
(
committer
);
entry
=
git__calloc
(
1
,
sizeof
(
git_reflog_entry
));
entry
=
git__calloc
(
1
,
sizeof
(
git_reflog_entry
));
GIT_ERROR_CHECK_ALLOC
(
entry
);
GIT_ERROR_CHECK_ALLOC
(
entry
);
...
@@ -139,13 +144,13 @@ int git_reflog_delete(git_repository *repo, const char *name)
...
@@ -139,13 +144,13 @@ int git_reflog_delete(git_repository *repo, const char *name)
size_t
git_reflog_entrycount
(
git_reflog
*
reflog
)
size_t
git_reflog_entrycount
(
git_reflog
*
reflog
)
{
{
assert
(
reflog
);
GIT_ASSERT_ARG_WITH_RETVAL
(
reflog
,
0
);
return
reflog
->
entries
.
length
;
return
reflog
->
entries
.
length
;
}
}
const
git_reflog_entry
*
git_reflog_entry_byindex
(
const
git_reflog
*
reflog
,
size_t
idx
)
const
git_reflog_entry
*
git_reflog_entry_byindex
(
const
git_reflog
*
reflog
,
size_t
idx
)
{
{
assert
(
reflog
);
GIT_ASSERT_ARG_WITH_RETVAL
(
reflog
,
NULL
);
if
(
idx
>=
reflog
->
entries
.
length
)
if
(
idx
>=
reflog
->
entries
.
length
)
return
NULL
;
return
NULL
;
...
@@ -154,27 +159,27 @@ const git_reflog_entry * git_reflog_entry_byindex(const git_reflog *reflog, size
...
@@ -154,27 +159,27 @@ const git_reflog_entry * git_reflog_entry_byindex(const git_reflog *reflog, size
&
reflog
->
entries
,
reflog_inverse_index
(
idx
,
reflog
->
entries
.
length
));
&
reflog
->
entries
,
reflog_inverse_index
(
idx
,
reflog
->
entries
.
length
));
}
}
const
git_oid
*
git_reflog_entry_id_old
(
const
git_reflog_entry
*
entry
)
const
git_oid
*
git_reflog_entry_id_old
(
const
git_reflog_entry
*
entry
)
{
{
assert
(
entry
);
GIT_ASSERT_ARG_WITH_RETVAL
(
entry
,
NULL
);
return
&
entry
->
oid_old
;
return
&
entry
->
oid_old
;
}
}
const
git_oid
*
git_reflog_entry_id_new
(
const
git_reflog_entry
*
entry
)
const
git_oid
*
git_reflog_entry_id_new
(
const
git_reflog_entry
*
entry
)
{
{
assert
(
entry
);
GIT_ASSERT_ARG_WITH_RETVAL
(
entry
,
NULL
);
return
&
entry
->
oid_cur
;
return
&
entry
->
oid_cur
;
}
}
const
git_signature
*
git_reflog_entry_committer
(
const
git_reflog_entry
*
entry
)
const
git_signature
*
git_reflog_entry_committer
(
const
git_reflog_entry
*
entry
)
{
{
assert
(
entry
);
GIT_ASSERT_ARG_WITH_RETVAL
(
entry
,
NULL
);
return
entry
->
committer
;
return
entry
->
committer
;
}
}
const
char
*
git_reflog_entry_message
(
const
git_reflog_entry
*
entry
)
const
char
*
git_reflog_entry_message
(
const
git_reflog_entry
*
entry
)
{
{
assert
(
entry
);
GIT_ASSERT_ARG_WITH_RETVAL
(
entry
,
NULL
);
return
entry
->
msg
;
return
entry
->
msg
;
}
}
...
...
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