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
4467543e
Commit
4467543e
authored
Jul 07, 2017
by
Patrick Steinhardt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ignore: return early to avoid useless indentation
parent
9bd83622
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
26 deletions
+24
-26
src/ignore.c
+24
-26
No files found.
src/ignore.c
View file @
4467543e
...
...
@@ -51,35 +51,33 @@ static int does_negate_pattern(git_attr_fnmatch *rule, git_attr_fnmatch *neg)
git_attr_fnmatch
*
longer
,
*
shorter
;
char
*
p
;
if
((
rule
->
flags
&
GIT_ATTR_FNMATCH_NEGATIVE
)
==
0
&&
(
neg
->
flags
&
GIT_ATTR_FNMATCH_NEGATIVE
)
!=
0
)
{
/* If lengths match we need to have an exact match */
if
(
rule
->
length
==
neg
->
length
)
{
return
strcmp
(
rule
->
pattern
,
neg
->
pattern
)
==
0
;
}
else
if
(
rule
->
length
<
neg
->
length
)
{
shorter
=
rule
;
longer
=
neg
;
}
else
{
shorter
=
neg
;
longer
=
rule
;
}
/* Otherwise, we need to check if the shorter
* rule is a basename only (that is, it contains
* no path separator) and, if so, if it
* matches the tail of the longer rule */
p
=
longer
->
pattern
+
longer
->
length
-
shorter
->
length
;
if
((
rule
->
flags
&
GIT_ATTR_FNMATCH_NEGATIVE
)
!=
0
||
(
neg
->
flags
&
GIT_ATTR_FNMATCH_NEGATIVE
)
==
0
)
return
false
;
/* If lengths match we need to have an exact match */
if
(
rule
->
length
==
neg
->
length
)
{
return
strcmp
(
rule
->
pattern
,
neg
->
pattern
)
==
0
;
}
else
if
(
rule
->
length
<
neg
->
length
)
{
shorter
=
rule
;
longer
=
neg
;
}
else
{
shorter
=
neg
;
longer
=
rule
;
}
if
(
p
[
-
1
]
!=
'/'
)
return
false
;
if
(
memchr
(
shorter
->
pattern
,
'/'
,
shorter
->
length
)
!=
NULL
)
return
false
;
/* Otherwise, we need to check if the shorter
* rule is a basename only (that is, it contains
* no path separator) and, if so, if it
* matches the tail of the longer rule */
p
=
longer
->
pattern
+
longer
->
length
-
shorter
->
length
;
return
memcmp
(
p
,
shorter
->
pattern
,
shorter
->
length
)
==
0
;
}
if
(
p
[
-
1
]
!=
'/'
)
return
false
;
if
(
memchr
(
shorter
->
pattern
,
'/'
,
shorter
->
length
)
!=
NULL
)
return
false
;
return
false
;
return
memcmp
(
p
,
shorter
->
pattern
,
shorter
->
length
)
==
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