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

Function _get_git_commit_sha

libs/code/deepagents_code/config.py:1323–1342  ·  view source on GitHub ↗

Return the current `HEAD` commit SHA, or `None` if unavailable. Resolved fresh on every call (unlike the branch/repo lookups): `HEAD` moves whenever the agent or user commits, checks out, or resets within a session, and each turn's trace must record the commit that was current for that

()

Source from the content-addressed store, hash-verified

1321
1322
1323def _get_git_commit_sha() -> str | None:
1324 """Return the current `HEAD` commit SHA, or `None` if unavailable.
1325
1326 Resolved fresh on every call (unlike the branch/repo lookups): `HEAD` moves
1327 whenever the agent or user commits, checks out, or resets within a session,
1328 and each turn's trace must record the commit that was current for that turn.
1329 """
1330 from deepagents_code._git import resolve_git_commit_sha
1331
1332 try:
1333 cwd = str(Path.cwd())
1334 except OSError:
1335 logger.debug("Could not determine cwd for git commit lookup", exc_info=True)
1336 return None
1337
1338 try:
1339 return resolve_git_commit_sha(cwd) or None
1340 except OSError:
1341 logger.debug("Could not determine git commit", exc_info=True)
1342 return None
1343
1344
1345def _get_repository_metadata() -> RepositoryMetadata | None:

Callers 1

Calls 1

resolve_git_commit_shaFunction · 0.90

Tested by

no test coverage detected