MCPcopy Index your code
hub / github.com/Codeplain-ai/codeplain / _get_commit

Function _get_commit

git_utils.py:284–295  ·  view source on GitHub ↗
(repo: Repo, frid: Optional[str])

Source from the content-addressed store, hash-verified

282
283
284def _get_commit(repo: Repo, frid: Optional[str]) -> str:
285 if frid:
286 commit_with_frid = _get_commit_with_frid(repo, frid)
287 if not commit_with_frid:
288 raise InvalidGitRepositoryError(f"No commit with frid {frid} found.")
289 return commit_with_frid
290
291 base_folder_commit = _get_base_folder_commit(repo)
292 initial_commit = _get_initial_commit(repo)
293 if base_folder_commit and repo.is_ancestor(repo.commit(initial_commit), repo.commit(base_folder_commit)):
294 return base_folder_commit
295 return initial_commit
296
297
298def _get_commit_with_frid(repo: Repo, frid: str, module_name: Optional[str] = None) -> str:

Callers 4

diffFunction · 0.85

Calls 4

_get_commit_with_fridFunction · 0.85
_get_base_folder_commitFunction · 0.85
_get_initial_commitFunction · 0.85

Tested by

no test coverage detected