Skip to content

Commit 48134bd

Browse files
committed
refactor: update glob pattern handling in AffiliationService to include text file extensions
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
1 parent 17a99a3 commit 48134bd

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

services/apps/git_integration/src/crowdgit/services/affiliation/affiliation_service.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ async def find_files_by_known_name(self, repo_path: str, known_name: str) -> lis
101101
"""Find repo paths whose basename matches a known affiliation filename."""
102102
glob_patterns = [f"**/{known_name}"]
103103
if not known_name.startswith("."):
104-
glob_patterns.append(f"**/{known_name}.*")
104+
for extension in self.TEXT_FILE_EXTENSIONS:
105+
if extension:
106+
glob_patterns.append(f"**/{known_name}{extension}")
105107

106108
glob_args = ["--glob", "!.git/"]
107109
for pattern in glob_patterns:
@@ -126,7 +128,7 @@ async def find_files_by_known_name(self, repo_path: str, known_name: str) -> lis
126128
continue
127129
if line.startswith("./"):
128130
line = line[2:]
129-
if self.path_matches_known_name(line, known_name):
131+
if self.path_matches_known_name(line, known_name) and self.is_text_file_path(line):
130132
matches.append(line)
131133

132134
return matches
@@ -315,7 +317,7 @@ async def discover_affiliation_file(
315317
return only_match, ai_cost
316318

317319
if len(matches) > 1:
318-
candidates = [path for path in matches if self.is_text_file_path(path)]
320+
candidates = matches
319321
root_files_only = False
320322
else:
321323
candidates = await self.list_root_text_files(repo_path)

0 commit comments

Comments
 (0)