Sfoglia il codice sorgente

* Added git helper to check for uncommitted changes

master
Klaus Nöske 4 anni fa
parent
commit
a607190e4f
1 ha cambiato i file con 21 aggiunte e 0 eliminazioni
  1. +21
    -0
      cmake/git_helper.cmake

+ 21
- 0
cmake/git_helper.cmake Vedi File

@@ -118,3 +118,24 @@ Function ( GitGetHash GIT_ROOT OUT_HASH )
Set ( ${OUT_HASH} ${HASH} PARENT_SCOPE )

EndFunction ( )

# Checks if the given git repository has uncommitted changes
Function ( GitGetIsDirty GIT_ROOT OUT_DIRTY )

If ( NOT EXISTS "${GIT_ROOT}/.git" )
Return ( )
EndIf ( )

GitExecute ( "git -C ${CMAKE_CURRENT_SOURCE_DIR} status -s -uall" True DIRTY SUCCESS )
If ( NOT ${SUCCESS} )
Return ( )
EndIf ( )

# dirty
If ( DIRTY )
Set ( ${OUT_DIRTY} 1 PARENT_SCOPE )
Else ( )
Set ( ${OUT_DIRTY} 0 PARENT_SCOPE )
EndIf ( )

EndFunction ( )

Caricamento…
Annulla
Salva