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
33bf1b1a
Commit
33bf1b1a
authored
May 28, 2014
by
Eoin Coffey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples/log.c: invert filtering impl and conditional
parent
87493bca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
examples/log.c
+14
-14
No files found.
examples/log.c
View file @
33bf1b1a
...
...
@@ -67,8 +67,8 @@ static void print_commit(git_commit *commit);
static
int
match_with_parent
(
git_commit
*
commit
,
int
i
,
git_diff_options
*
);
/** utility functions for filtering */
static
int
signature_
does_not_match
(
const
git_signature
*
sig
,
const
char
*
filter
);
static
int
log_message_
does_not_match
(
const
git_commit
*
commit
,
const
char
*
filter
);
static
int
signature_
matches
(
const
git_signature
*
sig
,
const
char
*
filter
);
static
int
log_message_
matches
(
const
git_commit
*
commit
,
const
char
*
filter
);
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
@@ -132,13 +132,13 @@ int main(int argc, char *argv[])
continue
;
}
if
(
signature_does_not_match
(
git_commit_author
(
commit
),
opt
.
author
))
if
(
!
signature_matches
(
git_commit_author
(
commit
),
opt
.
author
))
continue
;
if
(
signature_does_not_match
(
git_commit_committer
(
commit
),
opt
.
committer
))
if
(
!
signature_matches
(
git_commit_committer
(
commit
),
opt
.
committer
))
continue
;
if
(
log_message_does_not_match
(
commit
,
opt
.
grep
))
if
(
!
log_message_matches
(
commit
,
opt
.
grep
))
continue
;
if
(
count
++
<
opt
.
skip
)
...
...
@@ -186,26 +186,26 @@ int main(int argc, char *argv[])
}
/** Determine if the given git_signature does not contain the filter text. */
static
int
signature_
does_not_match
(
const
git_signature
*
sig
,
const
char
*
filter
)
{
static
int
signature_
matches
(
const
git_signature
*
sig
,
const
char
*
filter
)
{
if
(
filter
==
NULL
)
return
0
;
return
1
;
if
(
sig
==
NULL
||
(
strstr
(
sig
->
name
,
filter
)
==
NULL
&&
strstr
(
sig
->
email
,
filter
)
=
=
NULL
))
if
(
sig
!=
NULL
&&
(
strstr
(
sig
->
name
,
filter
)
!=
NULL
||
strstr
(
sig
->
email
,
filter
)
!
=
NULL
))
return
1
;
return
0
;
}
static
int
log_message_
does_not_match
(
const
git_commit
*
commit
,
const
char
*
filter
)
{
static
int
log_message_
matches
(
const
git_commit
*
commit
,
const
char
*
filter
)
{
const
char
*
message
=
NULL
;
if
(
filter
==
NULL
)
return
0
;
return
1
;
if
((
message
=
git_commit_message
(
commit
))
==
NULL
||
strstr
(
message
,
filter
)
=
=
NULL
)
if
((
message
=
git_commit_message
(
commit
))
!=
NULL
&&
strstr
(
message
,
filter
)
!
=
NULL
)
return
1
;
return
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