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
efab78cd
Commit
efab78cd
authored
Apr 05, 2020
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
blame: use GIT_ASSERT
parent
b44b262b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
src/blame.c
+11
-5
No files found.
src/blame.c
View file @
efab78cd
...
...
@@ -171,20 +171,21 @@ void git_blame_free(git_blame *blame)
uint32_t
git_blame_get_hunk_count
(
git_blame
*
blame
)
{
assert
(
blame
);
GIT_ASSERT_ARG
(
blame
);
return
(
uint32_t
)
blame
->
hunks
.
length
;
}
const
git_blame_hunk
*
git_blame_get_hunk_byindex
(
git_blame
*
blame
,
uint32_t
index
)
{
assert
(
blame
);
GIT_ASSERT_ARG_WITH_RETVAL
(
blame
,
NULL
);
return
(
git_blame_hunk
*
)
git_vector_get
(
&
blame
->
hunks
,
index
);
}
const
git_blame_hunk
*
git_blame_get_hunk_byline
(
git_blame
*
blame
,
size_t
lineno
)
{
size_t
i
,
new_lineno
=
lineno
;
assert
(
blame
);
GIT_ASSERT_ARG_WITH_RETVAL
(
blame
,
NULL
);
if
(
!
git_vector_bsearch2
(
&
i
,
&
blame
->
hunks
,
hunk_byfinalline_search_cmp
,
&
new_lineno
))
{
return
git_blame_get_hunk_byindex
(
blame
,
(
uint32_t
)
i
);
...
...
@@ -388,7 +389,10 @@ int git_blame_file(
git_blame_options
normOptions
=
GIT_BLAME_OPTIONS_INIT
;
git_blame
*
blame
=
NULL
;
assert
(
out
&&
repo
&&
path
);
GIT_ASSERT_ARG
(
out
);
GIT_ASSERT_ARG
(
repo
);
GIT_ASSERT_ARG
(
path
);
if
((
error
=
normalize_options
(
&
normOptions
,
options
,
repo
))
<
0
)
goto
on_error
;
...
...
@@ -509,7 +513,9 @@ int git_blame_buffer(
diffopts
.
context_lines
=
0
;
assert
(
out
&&
reference
&&
buffer
&&
buffer_len
);
GIT_ASSERT_ARG
(
out
);
GIT_ASSERT_ARG
(
reference
);
GIT_ASSERT_ARG
(
buffer
&&
buffer_len
);
blame
=
git_blame__alloc
(
reference
->
repository
,
reference
->
options
,
reference
->
path
);
GIT_ERROR_CHECK_ALLOC
(
blame
);
...
...
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