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
97fc71ab
Commit
97fc71ab
authored
May 22, 2014
by
Eoin Coffey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for --author flag in example log implementation
parent
9331f98a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletions
+10
-1
examples/log.c
+10
-1
No files found.
examples/log.c
View file @
97fc71ab
...
...
@@ -54,7 +54,7 @@ struct log_options {
int
min_parents
,
max_parents
;
git_time_t
before
;
git_time_t
after
;
char
*
author
;
c
onst
c
har
*
author
;
char
*
committer
;
};
...
...
@@ -75,6 +75,7 @@ int main(int argc, char *argv[])
git_oid
oid
;
git_commit
*
commit
=
NULL
;
git_pathspec
*
ps
=
NULL
;
const
git_signature
*
sig
;
git_threads_init
();
...
...
@@ -128,6 +129,12 @@ int main(int argc, char *argv[])
continue
;
}
if
(
opt
.
author
!=
NULL
)
{
if
((
sig
=
git_commit_author
(
commit
))
==
NULL
||
strstr
(
sig
->
name
,
opt
.
author
)
==
NULL
)
continue
;
}
if
(
count
++
<
opt
.
skip
)
continue
;
if
(
opt
.
limit
!=
-
1
&&
printed
++
>=
opt
.
limit
)
{
...
...
@@ -401,6 +408,8 @@ static int parse_options(
set_sorting
(
s
,
GIT_SORT_TOPOLOGICAL
);
else
if
(
!
strcmp
(
a
,
"--reverse"
))
set_sorting
(
s
,
GIT_SORT_REVERSE
);
else
if
(
match_str_arg
(
&
opt
->
author
,
&
args
,
"--author"
))
/** Found valid --author */
;
else
if
(
match_str_arg
(
&
s
->
repodir
,
&
args
,
"--git-dir"
))
/** Found git-dir. */
;
else
if
(
match_int_arg
(
&
opt
->
skip
,
&
args
,
"--skip"
,
0
))
...
...
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