MCPcopy Index your code
hub / github.com/GPflow/GPflow / _get_git_branch_and_commit

Function _get_git_branch_and_commit

benchmark/metadata.py:191–206  ·  view source on GitHub ↗

Get a `(branch_name, commit_id)` tuple from the current direcory.

()

Source from the content-addressed store, hash-verified

189
190
191def _get_git_branch_and_commit() -> Tuple[str, str]:
192 """ Get a `(branch_name, commit_id)` tuple from the current direcory. """
193 branch_name = "NO_BRANCH"
194 commit = "NO_COMMIT"
195 try:
196 repo = Repo(__file__, search_parent_directories=True)
197 try:
198 branch_name = str(repo.active_branch)
199 except TypeError:
200 pass # Keep current/default branch_name
201 commit = str(repo.commit())
202 if repo.is_dirty():
203 commit += " + uncomitted changes"
204 except InvalidGitRepositoryError:
205 pass # Keep current/default branch_name and commit
206 return branch_name, commit

Callers 1

createMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…