Skip to content

Commit

Permalink
limit depth
Browse files Browse the repository at this point in the history
  • Loading branch information
thenno committed Nov 1, 2023
1 parent 7e83a90 commit 91f7d6a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion terrarium/dl_gitmanager/dl_gitmanager/git_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
from git.repo.base import Repo as GitRepo


MAX_HISTORY_DEPTH = 300


@attr.s
class GitManager:
git_repo: GitRepo = attr.ib(kw_only=True)
Expand Down Expand Up @@ -133,7 +136,7 @@ def get_list_diff_paths(self, commits: Collection[str], absolute: bool = False)
return self._collect_paths_from_diffs(diff_iterable=self._iter_list_diffs(commits=commits, absolute=absolute))

def get_all_ancestor_commits(self, commit: str) -> set[str]:
commits = [commit.hexsha for commit in self.git_repo.iter_commits(commit)]
commits = [commit.hexsha for commit in self.git_repo.iter_commits(commit, max_count=MAX_HISTORY_DEPTH)]
return set(commits)

def get_missing_commits(self, base: str, head: str) -> set[str]:
Expand Down

0 comments on commit 91f7d6a

Please sign in to comment.