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
8 changes: 6 additions & 2 deletions gpt_repository_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ def get_ignore_list(ignore_file_path):

def should_ignore(file_path, ignore_list):
for pattern in ignore_list:
if fnmatch.fnmatch(file_path, pattern):
if pattern.startswith("!"):
negated_pattern = pattern[1:] # Remove the negation prefix '!'
if fnmatch.fnmatch(file_path, negated_pattern):
return False
elif fnmatch.fnmatch(file_path, pattern):
return True
return False

Expand Down Expand Up @@ -71,4 +75,4 @@ def process_repository(repo_path, ignore_list, output_file):
with open(output_file_path, 'a') as output_file:
output_file.write("--END--")
print(f"Repository contents written to {output_file_path}.")