MCPcopy Create free account
hub / github.com/langchain-ai/deepagents / resolve_git_commit_sha

Function resolve_git_commit_sha

libs/code/deepagents_code/_git.py:357–369  ·  view source on GitHub ↗

Resolve the current `HEAD` commit SHA, filesystem-first. Args: path: Directory or file path inside a repository. Returns: The full commit SHA, or an empty string when none can be determined.

(path: str | Path)

Source from the content-addressed store, hash-verified

355
356
357def resolve_git_commit_sha(path: str | Path) -> str:
358 """Resolve the current `HEAD` commit SHA, filesystem-first.
359
360 Args:
361 path: Directory or file path inside a repository.
362
363 Returns:
364 The full commit SHA, or an empty string when none can be determined.
365 """
366 sha = read_git_commit_sha_from_filesystem(path)
367 if sha is not None:
368 return sha
369 return read_git_commit_sha_via_subprocess(path)
370
371
372def read_git_remote_url_from_filesystem(path: str | Path) -> str | None:

Callers 4

_get_git_commit_shaFunction · 0.90
test_filesystem_winsMethod · 0.90
test_fallback_on_noneMethod · 0.90

Tested by 3

test_filesystem_winsMethod · 0.72
test_fallback_on_noneMethod · 0.72