@@ -51,35 +51,33 @@ static int does_negate_pattern(git_attr_fnmatch *rule, git_attr_fnmatch *neg)
5151 git_attr_fnmatch * longer , * shorter ;
5252 char * p ;
5353
54- if ((rule -> flags & GIT_ATTR_FNMATCH_NEGATIVE ) == 0
55- && (neg -> flags & GIT_ATTR_FNMATCH_NEGATIVE ) != 0 ) {
56-
57- /* If lengths match we need to have an exact match */
58- if (rule -> length == neg -> length ) {
59- return strcmp (rule -> pattern , neg -> pattern ) == 0 ;
60- } else if (rule -> length < neg -> length ) {
61- shorter = rule ;
62- longer = neg ;
63- } else {
64- shorter = neg ;
65- longer = rule ;
66- }
67-
68- /* Otherwise, we need to check if the shorter
69- * rule is a basename only (that is, it contains
70- * no path separator) and, if so, if it
71- * matches the tail of the longer rule */
72- p = longer -> pattern + longer -> length - shorter -> length ;
54+ if ((rule -> flags & GIT_ATTR_FNMATCH_NEGATIVE ) != 0
55+ || (neg -> flags & GIT_ATTR_FNMATCH_NEGATIVE ) == 0 )
56+ return false;
57+
58+ /* If lengths match we need to have an exact match */
59+ if (rule -> length == neg -> length ) {
60+ return strcmp (rule -> pattern , neg -> pattern ) == 0 ;
61+ } else if (rule -> length < neg -> length ) {
62+ shorter = rule ;
63+ longer = neg ;
64+ } else {
65+ shorter = neg ;
66+ longer = rule ;
67+ }
7368
74- if (p [-1 ] != '/' )
75- return false;
76- if (memchr (shorter -> pattern , '/' , shorter -> length ) != NULL )
77- return false;
69+ /* Otherwise, we need to check if the shorter
70+ * rule is a basename only (that is, it contains
71+ * no path separator) and, if so, if it
72+ * matches the tail of the longer rule */
73+ p = longer -> pattern + longer -> length - shorter -> length ;
7874
79- return memcmp (p , shorter -> pattern , shorter -> length ) == 0 ;
80- }
75+ if (p [-1 ] != '/' )
76+ return false;
77+ if (memchr (shorter -> pattern , '/' , shorter -> length ) != NULL )
78+ return false;
8179
82- return false ;
80+ return memcmp ( p , shorter -> pattern , shorter -> length ) == 0 ;
8381}
8482
8583/**
0 commit comments