Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions files_to_prompt/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,20 @@ def process_path(
files = [f for f in files if not f.startswith(".")]

if not ignore_gitignore:
gitignore_rules.extend(read_gitignore(root))
# Build the gitignore rules for this directory
# by combining parent rules with this directory's rules
current_rules = gitignore_rules.copy()
current_rules.extend(read_gitignore(root))

dirs[:] = [
d
for d in dirs
if not should_ignore(os.path.join(root, d), gitignore_rules)
if not should_ignore(os.path.join(root, d), current_rules)
]
files = [
f
for f in files
if not should_ignore(os.path.join(root, f), gitignore_rules)
if not should_ignore(os.path.join(root, f), current_rules)
]

if ignore_patterns:
Expand Down