Skip to content

Commit

Permalink
Few renames.
Browse files Browse the repository at this point in the history
  • Loading branch information
excitoon committed Aug 28, 2022
1 parent deb34f5 commit b174bf9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gitignorefile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def parse(path, base_path=None):

# We have negation rules. We can't use a simple "any" to evaluate them.
# Later rules override earlier rules.
return lambda file_path, is_dir=None: _handle_negation(file_path, rules, base_path=base_path, is_dir=is_dir)
return lambda file_path, is_dir=None: _match_rules(file_path, rules, base_path=base_path, is_dir=is_dir)


def ignore():
Expand Down Expand Up @@ -89,20 +89,20 @@ def __call__(self, path, is_dir=None):
) # This parent comes either from first or second loop.


def _handle_negation(file_path, rules, base_path=None, is_dir=None):
def _match_rules(path, rules, base_path=None, is_dir=None):
"""
Because Git allows for nested `.gitignore` files, a `base_path` value
is required for correct behavior.
"""
return_immediately = not any((r.negation for r in rules))

if is_dir is None:
is_dir = os.path.isdir(file_path)
is_dir = os.path.isdir(path)

if base_path is not None:
rel_path = os.path.relpath(file_path, base_path)
rel_path = os.path.relpath(path, base_path)
else:
rel_path = file_path
rel_path = path

if rel_path.startswith(f".{os.sep}"):
rel_path = rel_path[2:]
Expand Down

0 comments on commit b174bf9

Please sign in to comment.