Commit 4467543e by Patrick Steinhardt

ignore: return early to avoid useless indentation

parent 9bd83622
...@@ -51,35 +51,33 @@ static int does_negate_pattern(git_attr_fnmatch *rule, git_attr_fnmatch *neg) ...@@ -51,35 +51,33 @@ static int does_negate_pattern(git_attr_fnmatch *rule, git_attr_fnmatch *neg)
git_attr_fnmatch *longer, *shorter; git_attr_fnmatch *longer, *shorter;
char *p; char *p;
if ((rule->flags & GIT_ATTR_FNMATCH_NEGATIVE) == 0 if ((rule->flags & GIT_ATTR_FNMATCH_NEGATIVE) != 0
&& (neg->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) { /* If lengths match we need to have an exact match */
return strcmp(rule->pattern, neg->pattern) == 0; if (rule->length == neg->length) {
} else if (rule->length < neg->length) { return strcmp(rule->pattern, neg->pattern) == 0;
shorter = rule; } else if (rule->length < neg->length) {
longer = neg; shorter = rule;
} else { longer = neg;
shorter = neg; } else {
longer = rule; 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 (p[-1] != '/') /* Otherwise, we need to check if the shorter
return false; * rule is a basename only (that is, it contains
if (memchr(shorter->pattern, '/', shorter->length) != NULL) * no path separator) and, if so, if it
return false; * 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;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment