Skip to content

Commit 86f6807

Browse files
committed
raise error when commit hash is not available/provided
1 parent cca7bd7 commit 86f6807

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

src/gitingest/utils/s3_utils.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def generate_s3_file_path(
4545
user_name: str,
4646
repo_name: str,
4747
branch: str | None,
48-
commit: str | None,
48+
commit: str,
4949
include_patterns: set[str] | None,
5050
ignore_patterns: set[str],
5151
) -> str:
@@ -66,8 +66,8 @@ def generate_s3_file_path(
6666
Repository name.
6767
branch : str | None
6868
Branch name (if available).
69-
commit : str | None
70-
Commit hash (should always be available now).
69+
commit : str
70+
Commit hash.
7171
include_patterns : set[str] | None
7272
Set of patterns specifying which files to include.
7373
ignore_patterns : set[str]
@@ -98,10 +98,7 @@ def generate_s3_file_path(
9898

9999
patterns_hash = hashlib.sha256(patterns_str.encode()).hexdigest()[:16]
100100

101-
# Commit should always be available now, but provide fallback just in case
102-
commit_id = commit or "HEAD"
103-
104-
return f"ingest/{git_source}/{user_name}/{repo_name}/{branch_name}/{commit_id}/{patterns_hash}.txt"
101+
return f"ingest/{git_source}/{user_name}/{repo_name}/{branch_name}/{commit}/{patterns_hash}.txt"
105102

106103

107104
def create_s3_client() -> boto_client: # type: ignore[name-defined]

src/server/query_processor.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,7 @@ async def process_query(
8888

8989
# Get the current commit hash if not already available
9090
if not query.commit:
91-
try:
92-
query.commit = await get_current_commit_hash(clone_config.local_path)
93-
except RuntimeError:
94-
# If we can't get the commit hash, use a default
95-
query.commit = "HEAD"
91+
query.commit = await get_current_commit_hash(clone_config.local_path)
9692

9793
summary, tree, content = ingest_query(query)
9894

0 commit comments

Comments
 (0)