diff --git a/srctag/collector.py b/srctag/collector.py index aefd6b6..62aeeeb 100644 --- a/srctag/collector.py +++ b/srctag/collector.py @@ -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)