mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			20 lines
		
	
	
		
			418 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			418 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| import subprocess
 | |
| 
 | |
| 
 | |
| def run_git_command(command):
 | |
|     process = subprocess.run(
 | |
|         command,
 | |
|         encoding='utf8',
 | |
|         capture_output=True,
 | |
|         check=True,
 | |
|     )
 | |
|     return process.stdout.strip()
 | |
| 
 | |
| 
 | |
| def git_current_branch():
 | |
|     return run_git_command(['git', 'symbolic-ref', 'HEAD', '--short'])
 | |
| 
 | |
| 
 | |
| def git_commit_hash(ref: str = 'HEAD'):
 | |
|     return run_git_command(['git', 'rev-parse', '--verify', ref])
 |