Skip to content

Commit

Permalink
draft: Add an option to limit maximum commits used for frecency
Browse files Browse the repository at this point in the history
Refs #711
  • Loading branch information
last-partizan committed Nov 18, 2024
1 parent 587938a commit b614d29
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ This is an example of a configuration file:

server:
port: 31134 # A port number to run the server on
# Increase number of commits used for computing frecency score
# Default is `1000`, set to `null` to read all history
readMaxCommits: 5000

# globs to ignore in addition to .gitignore
ignorePatterns:
Expand Down
3 changes: 3 additions & 0 deletions seagoat/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ def analyze_files(self):
"--no-merges",
]

if (max_commits := self.config["server"]["readMaxCommits"]) is not None:
cmd.append(f"--max-count={max_commits}")

self.file_changes.clear()

files = set(
Expand Down
2 changes: 2 additions & 0 deletions seagoat/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"server": {
"port": None,
"ignorePatterns": [],
"readMaxCommits": 1000,
"chroma": {
"embeddingFunction": {
"name": "DefaultEmbeddingFunction",
Expand All @@ -35,6 +36,7 @@
"additionalProperties": False,
"properties": {
"port": {"type": "integer", "minimum": 1, "maximum": 65535},
"readMaxCommits": {"type": ["integer", "null"], "minimum": 1, "maximum": 65535},
"ignorePatterns": {
"type": "array",
"items": {"type": "string"},
Expand Down

0 comments on commit b614d29

Please sign in to comment.