mirror of
				https://github.com/KartKrewDev/RingRacers.git
				synced 2025-10-30 08:01:28 +00:00 
			
		
		
		
	remotes/origin/HEAD is valid, exists in my repo and I do not know why but it makes checking out origin/master show up as HEAD in game so KILL.
		
			
				
	
	
		
			59 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			CMake
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			CMake
		
	
	
	
	
	
# Git utilities
 | 
						|
 | 
						|
if(__GitUtilities)
 | 
						|
	return()
 | 
						|
endif()
 | 
						|
 | 
						|
set(__GitUtilities ON)
 | 
						|
 | 
						|
macro(_git_command)
 | 
						|
	execute_process(
 | 
						|
		COMMAND "${GIT_EXECUTABLE}" ${ARGN}
 | 
						|
		WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
 | 
						|
		OUTPUT_VARIABLE output
 | 
						|
		ERROR_QUIET
 | 
						|
		OUTPUT_STRIP_TRAILING_WHITESPACE
 | 
						|
	)
 | 
						|
endmacro()
 | 
						|
 | 
						|
macro(_git_easy_command)
 | 
						|
	_git_command(${ARGN})
 | 
						|
	set(${variable} "${output}" PARENT_SCOPE)
 | 
						|
endmacro()
 | 
						|
 | 
						|
function(git_current_branch variable)
 | 
						|
	_git_command(symbolic-ref -q --short HEAD)
 | 
						|
 | 
						|
	# If a detached head, a ref could still be resolved.
 | 
						|
	if("${output}" STREQUAL "")
 | 
						|
		_git_command(describe --all --exact-match --exclude */HEAD)
 | 
						|
 | 
						|
		# Get the ref, in the form heads/master or
 | 
						|
		# remotes/origin/master so isolate the final part.
 | 
						|
		string(REGEX REPLACE ".*/" "" output "${output}")
 | 
						|
	endif()
 | 
						|
 | 
						|
	set(${variable} "${output}" PARENT_SCOPE)
 | 
						|
endfunction()
 | 
						|
 | 
						|
function(git_latest_commit variable)
 | 
						|
	_git_easy_command(rev-parse --short HEAD)
 | 
						|
endfunction()
 | 
						|
 | 
						|
function(git_working_tree_dirty variable)
 | 
						|
	_git_command(status --porcelain -uno)
 | 
						|
 | 
						|
	if(output STREQUAL "")
 | 
						|
		set(${variable} FALSE PARENT_SCOPE)
 | 
						|
	else()
 | 
						|
		set(${variable} TRUE PARENT_SCOPE)
 | 
						|
	endif()
 | 
						|
endfunction()
 | 
						|
 | 
						|
function(git_subject variable)
 | 
						|
	_git_easy_command(log -1 --format=%s)
 | 
						|
endfunction()
 | 
						|
 | 
						|
function(get_git_dir variable)
 | 
						|
	_git_easy_command(rev-parse --git-dir)
 | 
						|
endfunction()
 |