mirror of
https://github.com/open-compass/opencompass.git
synced 2025-05-30 16:03:24 +08:00
14 lines
417 B
Python
14 lines
417 B
Python
import subprocess
|
|
|
|
|
|
def get_git_root() -> str:
|
|
cmd = ['git', 'rev-parse', '--show-toplevel']
|
|
result = subprocess.run(cmd, stdout=subprocess.PIPE, check=True)
|
|
return result.stdout.decode('utf-8').strip()
|
|
|
|
|
|
def get_latest_commit(branch: str) -> str:
|
|
cmd = ['git', 'rev-parse', branch]
|
|
result = subprocess.run(cmd, stdout=subprocess.PIPE, check=True)
|
|
return result.stdout.decode('utf-8').strip()
|