@@ -167,7 +167,7 @@ def _diffiter(
167167 if pdiff .startswith ("Binary files" ): # pragma: no cover
168168 continue
169169
170- pattern = _match (fpath , exclude_set , recursive = True )
170+ pattern = _match (fpath , exclude_set )
171171 if pattern :
172172 log .debug (f"skipping diff '{ fpath } ': '{ pattern } '" )
173173 continue
@@ -218,13 +218,9 @@ def _get_branches(
218218 return [repo .branches [branch ] if branch else repo .active_branch ]
219219
220220
221- def _match (
222- path : str , patterns : Iterable [str ] = None , recursive : bool = False
223- ) -> Optional [str ]:
221+ def _match (path : str , patterns : Iterable [str ] = None ) -> Optional [str ]:
224222 """Match path against given glob patterns and return matched pattern if any.
225223
226- If `recursive` is set to True, check all parent directories as well.
227-
228224 Note
229225 ----
230226 Return None if `patterns` is empty or not set.
@@ -241,18 +237,16 @@ def _match(
241237 '*.yml'
242238 >>> _match(".git/hooks/update.sample", [".git/*"]) is None
243239 True
244- >>> _match(".git/hooks/update.sample", [".git/*"], recursive=True )
245- '.git/*'
240+ >>> _match(".git/hooks/update.sample", [".git/**/*"] )
241+ '.git/**/* '
246242
247243 """
248244 if not patterns :
249245 return None
250246
251247 fpath = Path (path )
252- paths = [fpath , * fpath .parents ] if recursive else [fpath ]
253- for p in paths :
254- for glob in patterns :
255- if p .match (glob ):
256- return glob
248+ for glob in patterns :
249+ if fpath .full_match (glob ):
250+ return glob
257251
258252 return None
0 commit comments