File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 4040 git_commit_head_file = os .path .join (RANDO_ROOT_PATH , ".git" , "HEAD" )
4141 if os .path .isfile (git_commit_head_file ):
4242 with open (git_commit_head_file , "r" ) as f :
43- head_file_contents = f .read ()
43+ head_file_contents = f .read (). strip ()
4444 if head_file_contents .startswith ("ref: " ):
45- relative_path_to_hash_file = head_file_contents [len ("ref: " ):].strip ()
45+ # Normal head, HEAD file has a reference to a branch which contains the commit hash
46+ relative_path_to_hash_file = head_file_contents [len ("ref: " ):]
4647 path_to_hash_file = os .path .join (RANDO_ROOT_PATH , ".git" , relative_path_to_hash_file )
4748 if os .path .isfile (path_to_hash_file ):
4849 with open (path_to_hash_file , "r" ) as f :
4950 hash_file_contents = f .read ()
5051 version_suffix = "_" + hash_file_contents [:7 ]
52+ elif re .search (r"^[0-9a-f]{40}$" , head_file_contents ):
53+ # Detached head, commit hash directly in the HEAD file
54+ version_suffix = "_" + head_file_contents [:7 ]
5155
5256 VERSION += version_suffix
5357
You can’t perform that action at this time.
0 commit comments