Skip to content

Commit

Permalink
fix: allow specific file is dir
Browse files Browse the repository at this point in the history
  • Loading branch information
williamfzc committed Jan 30, 2024
1 parent 432bf47 commit b4a1449
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions srctag/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,18 @@ def _check_env(self) -> typing.Optional[BaseException]:

def _collect_files(self, ctx: RuntimeContext):
"""collect all files which tracked by git"""
git_repo = git.Repo(self.config.repo_root)
git_track_files = set([each[1].path for each in git_repo.index.iter_blobs()])
if self.config.include_file_list:
logger.info("use specific file list")
for each in self.config.include_file_list:
if each not in git_track_files:
logger.warning(f"specific file {each} not in git track, ignored")
continue
ctx.files[each] = FileContext(each)
# END file list loop
return
# END check file list

logger.info("include file list is empty, use regex")
git_repo = git.Repo(self.config.repo_root)
git_track_files = set([each[1].path for each in git_repo.index.iter_blobs()])

include_regex = None
if self.config.include_regex:
include_regex = re.compile(self.config.include_regex)
Expand Down

0 comments on commit b4a1449

Please sign in to comment.