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
426d8456
Commit
426d8456
authored
Jan 08, 2014
by
Ben Straub
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2033 from xtao/blame_orig_commit
Add orig_commit.
parents
cc3d961b
b92b434f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
src/blame.c
+4
-2
tests/blame/blame_helpers.c
+3
-0
No files found.
src/blame.c
View file @
426d8456
...
...
@@ -242,7 +242,7 @@ static int index_blob_lines(git_blame *blame)
git_off_t
len
=
blame
->
final_buf_size
;
int
num
=
0
,
incomplete
=
0
,
bol
=
1
;
size_t
*
i
;
if
(
len
&&
buf
[
len
-
1
]
!=
'\n'
)
incomplete
++
;
/* incomplete line at the end */
while
(
len
--
)
{
...
...
@@ -263,13 +263,15 @@ static int index_blob_lines(git_blame *blame)
blame
->
num_lines
=
num
+
incomplete
;
return
blame
->
num_lines
;
}
static
git_blame_hunk
*
hunk_from_entry
(
git_blame__entry
*
e
)
{
git_blame_hunk
*
h
=
new_hunk
(
e
->
lno
+
1
,
e
->
num_lines
,
e
->
s_lno
+
1
,
e
->
suspect
->
path
);
git_oid_cpy
(
&
h
->
final_commit_id
,
git_commit_id
(
e
->
suspect
->
commit
));
git_oid_cpy
(
&
h
->
orig_commit_id
,
git_commit_id
(
e
->
suspect
->
commit
));
h
->
final_signature
=
git_signature_dup
(
git_commit_author
(
e
->
suspect
->
commit
));
h
->
orig_signature
=
git_signature_dup
(
git_commit_author
(
e
->
suspect
->
commit
));
h
->
boundary
=
e
->
is_boundary
?
1
:
0
;
return
h
;
}
...
...
tests/blame/blame_helpers.c
View file @
426d8456
...
...
@@ -48,6 +48,9 @@ void check_blame_hunk_index(git_repository *repo, git_blame *blame, int idx,
actual
,
expected
);
}
cl_assert_equal_s
(
actual
,
expected
);
cl_assert_equal_i
(
git_oid_cmp
(
&
hunk
->
final_commit_id
,
&
hunk
->
orig_commit_id
),
0
);
if
(
strcmp
(
hunk
->
orig_path
,
orig_path
))
{
hunk_message
(
idx
,
hunk
,
"has mismatched original path (got '%s', expected '%s')
\n
"
,
hunk
->
orig_path
,
orig_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