Skip to content

Commit

Permalink
ECC-1904: API function to get the git branch
Browse files Browse the repository at this point in the history
  • Loading branch information
shahramn committed Aug 15, 2024
1 parent 837c9af commit 634134e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ if(GIT_FOUND AND NOT ${GIT_EXECUTABLE} STREQUAL "")
ecbuild_info("Found git: ${GIT_EXECUTABLE} (found version \"${GIT_VERSION_STRING}\")")
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
OUTPUT_VARIABLE eccodes_GIT_BRANCH
RESULT_VARIABLE nok ERROR_VARIABLE error
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" )
ecbuild_info("ecCodes branch = ${eccodes_GIT_BRANCH}" )
Expand Down
9 changes: 7 additions & 2 deletions tools/codes_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ static void print_debug_info(grib_context* context)
#ifdef HAVE_AEC
aec = 1;
#endif
grib_context_log(context, GRIB_LOG_DEBUG, "Git branch: %s", grib_get_git_branch());
grib_context_log(context, GRIB_LOG_DEBUG, "Git SHA1: %s", grib_get_git_sha1());
const char* git_branch = grib_get_git_branch();
const char* git_sha1 = grib_get_git_sha1();
if (strlen(git_branch) > 0)
grib_context_log(context, GRIB_LOG_DEBUG, "Git branch: %s", git_branch);
if (strlen(git_sha1) > 0)
grib_context_log(context, GRIB_LOG_DEBUG, "Git SHA1: %s", git_sha1);

grib_context_log(context, GRIB_LOG_DEBUG, "Build date: %s", codes_get_build_date());
grib_context_log(context, GRIB_LOG_DEBUG, "Features:");
grib_context_log(context, GRIB_LOG_DEBUG, " HAVE_AEC=%d", aec);
Expand Down

0 comments on commit 634134e

Please sign in to comment.