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
2ccc84d2
Commit
2ccc84d2
authored
Oct 09, 2013
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow null bytes in blob
parent
cb45dafa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
examples/blame.c
+11
-10
No files found.
examples/blame.c
View file @
2ccc84d2
...
...
@@ -29,7 +29,7 @@ static void usage(const char *msg, const char *arg)
int
main
(
int
argc
,
char
*
argv
[])
{
int
i
;
int
i
,
line
;
char
*
path
=
NULL
,
*
a
;
const
char
*
rawdata
,
*
commitspec
=
NULL
;
git_repository
*
repo
=
NULL
;
...
...
@@ -99,11 +99,12 @@ int main(int argc, char *argv[])
rawdata
=
git_blob_rawcontent
(
blob
);
/* Produce the output */
i
=
1
;
while
(
rawdata
[
0
])
{
const
char
*
eol
=
strchr
(
rawdata
,
'\n'
);
line
=
1
;
i
=
0
;
while
(
i
<
git_blob_rawsize
(
blob
))
{
const
char
*
eol
=
strchr
(
rawdata
+
i
,
'\n'
);
char
oid
[
10
]
=
{
0
};
const
git_blame_hunk
*
hunk
=
git_blame_get_hunk_byline
(
blame
,
i
);
const
git_blame_hunk
*
hunk
=
git_blame_get_hunk_byline
(
blame
,
line
);
git_commit
*
hunkcommit
;
const
git_signature
*
sig
;
...
...
@@ -114,13 +115,13 @@ int main(int argc, char *argv[])
printf
(
"%s ( %-30s %3d) %.*s
\n
"
,
oid
,
sig
->
name
,
i
,
(
int
)(
eol
-
rawdata
),
rawdata
);
line
,
(
int
)(
eol
-
rawdata
-
i
),
rawdata
+
i
);
git_commit_free
(
hunkcommit
);
rawdata
=
eol
+
1
;
i
++
;
i
=
eol
-
rawdata
+
1
;
line
++
;
}
/* Cleanup */
...
...
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