Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit 5943c602 authored by florez_j's avatar florez_j
Browse files

Add constraint to match only path/to/keyword1/keyword2/files containing a...

Add constraint to match only path/to/keyword1/keyword2/files containing a composite keyword keyword1/keyword2.
parent 58386ca1
No related branches found
No related tags found
No related merge requests found
......@@ -285,6 +285,11 @@ def copy_directory_with_contraints(input_dir_path, output_dir_path,
select_file_keywords = select_file_keywords or []
allowed_file_extensions = allowed_file_extensions or []
# Normalize paths and keywords to be consistently specified with os specific separator
input_dir_path = os.path.normpath(input_dir_path)
output_dir_path = os.path.normpath(output_dir_path)
select_dir_keywords = [keyword.replace('/',os.sep) for keyword in select_dir_keywords]
date = created_at('%Y_%m').replace(":", "-")
log_dir='logs/'
setup_logging(log_dir, f"copy_directory_with_contraints_{date}.log")
......@@ -312,6 +317,10 @@ def copy_directory_with_contraints(input_dir_path, output_dir_path,
for subpath in paths:
for dirpath, _, filenames in os.walk(subpath,topdown=False):
# Ensure composite keywords e.g., <keyword>/<keyword> are contained in the path
if not any([keyword in dirpath for keyword in select_dir_keywords]):
continue
# Reduce filenames to those that are admissible
admissible_filenames = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment