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
b6f60a4d
Commit
b6f60a4d
authored
Sep 21, 2013
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up ported code
parent
77db6ff5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
24 deletions
+21
-24
src/blame.c
+8
-16
src/blame_git.c
+0
-0
src/blame_git.h
+13
-8
No files found.
src/blame.c
View file @
b6f60a4d
...
...
@@ -260,6 +260,8 @@ static int load_blob(git_blame *blame)
{
int
error
;
if
(
blame
->
final_blob
)
return
0
;
error
=
git_commit_lookup
(
&
blame
->
final
,
blame
->
repository
,
&
blame
->
options
.
newest_commit
);
if
(
error
<
0
)
goto
cleanup
;
...
...
@@ -276,20 +278,13 @@ static int blame_internal(git_blame *blame)
{
int
error
;
git_blame__entry
*
ent
=
NULL
;
git_blob
*
blob
=
NULL
;
git_blame__origin
*
o
;
if
((
error
=
git_commit_lookup
(
&
blame
->
final
,
blame
->
repository
,
&
blame
->
options
.
newest_commit
))
<
0
||
(
error
=
git_object_lookup_bypath
((
git_object
**
)
&
blob
,
(
git_object
*
)
blame
->
final
,
blame
->
path
,
GIT_OBJ_BLOB
))
<
0
)
goto
cleanup
;
blame
->
final_buf
=
git_blob_rawcontent
(
blob
);
blame
->
final_buf_size
=
git_blob_rawsize
(
blob
);
if
((
error
=
get_origin
(
&
o
,
blame
,
blame
->
final
,
blame
->
path
))
<
0
)
if
((
error
=
load_blob
(
blame
))
<
0
||
(
error
=
git_blame__get_origin
(
&
o
,
blame
,
blame
->
final
,
blame
->
path
))
<
0
)
goto
cleanup
;
blame
->
final_buf
=
git_blob_rawcontent
(
blame
->
final_blob
);
blame
->
final_buf_size
=
git_blob_rawsize
(
blame
->
final_blob
);
ent
=
git__calloc
(
1
,
sizeof
(
git_blame__entry
));
ent
->
num_lines
=
index_blob_lines
(
blame
);
...
...
@@ -303,8 +298,7 @@ static int blame_internal(git_blame *blame)
blame
->
ent
=
ent
;
blame
->
path
=
blame
->
path
;
assign_blame
(
blame
,
blame
->
options
.
flags
);
coalesce
(
blame
);
git_blame__like_git
(
blame
,
blame
->
options
.
flags
);
cleanup:
for
(
ent
=
blame
->
ent
;
ent
;
)
{
...
...
@@ -312,12 +306,10 @@ cleanup:
git_vector_insert
(
&
blame
->
hunks
,
hunk_from_entry
(
ent
));
origin_decref
(
ent
->
suspect
);
git__free
(
ent
);
git_blame__free_entry
(
ent
);
ent
=
e
;
}
git_blob_free
(
blob
);
return
error
;
}
...
...
src/blame_git.c
View file @
b6f60a4d
This diff is collapsed.
Click to expand it.
src/blame_git.h
View file @
b6f60a4d
/*
* Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_blame_git__
#define INCLUDE_blame_git__
#include "git2.h"
#include "blame.h"
#include "xdiff/xinclude.h"
int
get_origin
(
git_blame__origin
**
out
,
git_blame
*
sb
,
git_commit
*
commit
,
const
char
*
path
);
int
make_origin
(
git_blame__origin
**
out
,
git_commit
*
commit
,
const
char
*
path
);
git_blame__origin
*
origin_incref
(
git_blame__origin
*
o
);
void
origin_decref
(
git_blame__origin
*
o
);
void
assign_blame
(
git_blame
*
sb
,
uint32_t
flags
);
void
coalesce
(
git_blame
*
sb
);
int
git_blame__get_origin
(
git_blame__origin
**
out
,
git_blame
*
sb
,
git_commit
*
commit
,
const
char
*
path
);
void
git_blame__free_entry
(
git_blame__entry
*
ent
);
void
git_blame__like_git
(
git_blame
*
sb
,
uint32_t
flags
);
#endif
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