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
a121e580
Commit
a121e580
authored
Sep 20, 2013
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add typedefs for internal structs
parent
25c47aae
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
78 deletions
+82
-78
src/blame.c
+7
-7
src/blame_git.c
+57
-53
src/blame_git.h
+18
-18
No files found.
src/blame.c
View file @
a121e580
...
...
@@ -221,7 +221,7 @@ static git_blame_hunk *split_hunk_in_vector(
* To allow quick access to the contents of nth line in the
* final image, prepare an index in the scoreboard.
*/
static
int
prepare_lines
(
struct
scoreboard
*
sb
)
static
int
prepare_lines
(
git_blame__
scoreboard
*
sb
)
{
const
char
*
buf
=
sb
->
final_buf
;
git_off_t
len
=
sb
->
final_buf_size
;
...
...
@@ -242,7 +242,7 @@ static int prepare_lines(struct scoreboard *sb)
return
sb
->
num_lines
;
}
static
git_blame_hunk
*
hunk_from_entry
(
struct
blame
_entry
*
e
)
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
);
...
...
@@ -255,10 +255,10 @@ static int walk_and_mark(git_blame *blame)
{
int
error
;
struct
scoreboard
sb
=
{
0
};
struct
blame
_entry
*
ent
=
NULL
;
git_blame__
scoreboard
sb
=
{
0
};
git_blame_
_entry
*
ent
=
NULL
;
git_blob
*
blob
=
NULL
;
struct
origin
*
o
;
git_blame__
origin
*
o
;
if
((
error
=
git_commit_lookup
(
&
sb
.
final
,
blame
->
repository
,
&
blame
->
options
.
newest_commit
))
<
0
||
(
error
=
git_object_lookup_bypath
((
git_object
**
)
&
blob
,
(
git_object
*
)
sb
.
final
,
blame
->
path
,
GIT_OBJ_BLOB
))
<
0
)
...
...
@@ -287,8 +287,8 @@ static int walk_and_mark(git_blame *blame)
cleanup:
for
(
ent
=
sb
.
ent
;
ent
;
)
{
struct
blame
_entry
*
e
=
ent
->
next
;
struct
origin
*
o
=
ent
->
suspect
;
git_blame_
_entry
*
e
=
ent
->
next
;
git_blame__
origin
*
o
=
ent
->
suspect
;
git_vector_insert
(
&
blame
->
hunks
,
hunk_from_entry
(
ent
));
...
...
src/blame_git.c
View file @
a121e580
This diff is collapsed.
Click to expand it.
src/blame_git.h
View file @
a121e580
...
...
@@ -9,22 +9,22 @@
/*
* One blob in a commit that is being suspected
*/
struct
origin
{
typedef
struct
git_blame__
origin
{
int
refcnt
;
struct
origin
*
previous
;
struct
git_blame__
origin
*
previous
;
git_commit
*
commit
;
git_blob
*
blob
;
char
path
[];
};
}
git_blame__origin
;
/*
* Each group of lines is described by a
blame
_entry; it can be split
* Each group of lines is described by a
git_blame_
_entry; it can be split
* as we pass blame to the parents. They form a linked list in the
* scoreboard structure, sorted by the target line number.
*/
struct
blame
_entry
{
struct
blame
_entry
*
prev
;
struct
blame
_entry
*
next
;
typedef
struct
git_blame_
_entry
{
struct
git_blame_
_entry
*
prev
;
struct
git_blame_
_entry
*
next
;
/* the first line of this group in the final image;
* internally all line numbers are 0 based.
...
...
@@ -35,7 +35,7 @@ struct blame_entry {
int
num_lines
;
/* the commit that introduced this group into the final image */
struct
origin
*
suspect
;
git_blame__
origin
*
suspect
;
/* true if the suspect is truly guilty; false while we have not
* checked if the group came from one of its parents.
...
...
@@ -59,12 +59,12 @@ struct blame_entry {
/* Whether this entry has been tracked to a boundary commit.
*/
bool
is_boundary
;
};
}
git_blame__entry
;
/*
* The current state of the blame assignment.
*/
struct
scoreboard
{
typedef
struct
git_blame__
scoreboard
{
/* the final commit (i.e. where we started digging from) */
git_commit
*
final
;
const
char
*
path
;
...
...
@@ -78,20 +78,20 @@ struct scoreboard {
git_off_t
final_buf_size
;
/* linked list of blames */
struct
blame
_entry
*
ent
;
git_blame_
_entry
*
ent
;
/* look-up a line in the final buffer */
int
num_lines
;
git_blame
*
blame
;
};
}
git_blame__scoreboard
;
int
get_origin
(
struct
origin
**
out
,
struct
scoreboard
*
sb
,
git_commit
*
commit
,
const
char
*
path
);
int
make_origin
(
struct
origin
**
out
,
git_commit
*
commit
,
const
char
*
path
);
struct
origin
*
origin_incref
(
struct
origin
*
o
);
void
origin_decref
(
struct
origin
*
o
);
void
assign_blame
(
struct
scoreboard
*
sb
,
uint32_t
flags
);
void
coalesce
(
struct
scoreboard
*
sb
);
int
get_origin
(
git_blame__origin
**
out
,
git_blame__
scoreboard
*
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__
scoreboard
*
sb
,
uint32_t
flags
);
void
coalesce
(
git_blame__
scoreboard
*
sb
);
#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