Commit 3eea53ad authored by Jarosław Staniek's avatar Jarosław Staniek

Add git HEAD hash and branch name in Kexi about dialog

This extra info precisely specifies version used if compiled from git.
It's extra convenience for bug reports. Krita already uses HEAD hash, here we're adding branch name too.

See http://kexi-project.org/pics/forum/2014/about-kexi-git.jpg

Added get_git_branch() to GetGitRevisionDescription.

REVIEW:118175
parent a7b8e18d
......@@ -52,11 +52,13 @@ set(CALLIGRA_GIT_SHA1_STRING "")
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
get_git_branch(GIT_BRANCH)
if(GIT_SHA1)
if(GIT_SHA1 AND GIT_BRANCH)
string(SUBSTRING ${GIT_SHA1} 0 7 GIT_SHA1)
set(CALLIGRA_GIT_SHA1_STRING ${GIT_SHA1})
endif(GIT_SHA1)
set(CALLIGRA_GIT_BRANCH_STRING ${GIT_BRANCH})
endif()
########################
#########################
......
......@@ -124,6 +124,33 @@ function(git_describe _var)
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(get_git_branch _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
return()
endif()
execute_process(COMMAND
"${GIT_EXECUTABLE}"
symbolic-ref --short HEAD
WORKING_DIRECTORY
"${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(git_get_exact_tag _var)
git_describe(out --exact-match ${ARGN})
set(${_var} "${out}" PARENT_SCOPE)
......
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
* Copyright (C) 2014 Jarosław Staniek <staniek@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -26,4 +27,11 @@
*/
#cmakedefine CALLIGRA_GIT_SHA1_STRING "@CALLIGRA_GIT_SHA1_STRING@"
/**
* @def CALLIGRA_GIT_BRANCH_STRING
* @ingroup CalligraMacros
* @brief Indicates the git branch name which was used for compilation of Calligra
*/
#cmakedefine CALLIGRA_GIT_BRANCH_STRING "@CALLIGRA_GIT_BRANCH_STRING@"
#endif /* __CALLIGRA_GIT_VERSION_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment