<commit_before>sprokit_configure_file(config.h
  "${CMAKE_CURRENT_SOURCE_DIR}/config.h.in"
  "${CMAKE_CURRENT_BINARY_DIR}/config.h"
  SPROKIT_HAVE_GCC_VISIBILITY)

set(SPROKIT_BUILT_FROM_GIT)

if (GIT_FOUND)
  set(configure_code "
if (IS_DIRECTORY \"${sprokit_source_dir}/.git\")
  set(SPROKIT_BUILT_FROM_GIT TRUE)

  execute_process(
    COMMAND           \"${GIT_EXECUTABLE}\"
                      rev-parse
                      HEAD
    WORKING_DIRECTORY \"${sprokit_source_dir}\"
    RESULT_VARIABLE   git_return
    OUTPUT_VARIABLE   sprokit_git_hash)
  execute_process(
    COMMAND           \"${GIT_EXECUTABLE}\"
                      rev-parse
                      --short
                      HEAD
    WORKING_DIRECTORY \"${sprokit_source_dir}\"
    RESULT_VARIABLE   git_return
    OUTPUT_VARIABLE   sprokit_git_hash_short)
  execute_process(
    COMMAND           \"${GIT_EXECUTABLE}\"
                      diff
                      --no-ext-diff
                      --quiet
                      --exit-code
    WORKING_DIRECTORY \"${sprokit_source_dir}\"
    RESULT_VARIABLE   git_return)

  string(STRIP \"\${sprokit_git_hash}\" sprokit_git_hash)
  string(STRIP \"\${sprokit_git_hash_short}\" sprokit_git_hash_short)

  if (git_return)
    set(sprokit_git_dirty \"dirty\")
  endif ()

  message(STATUS \"version: \${sprokit_version}\")
  message(STATUS \"git hash: \${sprokit_git_hash}\")
  message(STATUS \"git short hash: \${sprokit_git_hash_short}\")
  message(STATUS \"git dirty: \${sprokit_git_dirty}\")
endif ()
")
else ()
  if ("$Format:$" STREQUAL "")
    set(sprokit_git_hash       "$Format:%H$")
    set(sprokit_git_hash_short "$Format:%h$")

    option(SPROKIT_IS_PATCHED "Set to ON if patches are applied on top of a released tarball" OFF)
    if (SPROKIT_IS_PATCHED)
      set(sprokit_git_dirty "dirty")
    endif ()
  endif ()
endif ()<commit_msg>Fix the precedence of git hash calculations<commit_after>sprokit_configure_file(config.h
  "${CMAKE_CURRENT_SOURCE_DIR}/config.h.in"
  "${CMAKE_CURRENT_BINARY_DIR}/config.h"
  SPROKIT_HAVE_GCC_VISIBILITY)

set(SPROKIT_BUILT_FROM_GIT)

if ("$Format:$" STREQUAL "")
  set(sprokit_git_hash       "$Format:%H$")
  set(sprokit_git_hash_short "$Format:%h$")

  option(SPROKIT_IS_PATCHED "Set to ON if patches are applied on top of a released tarball" OFF)
  if (SPROKIT_IS_PATCHED)
    set(sprokit_git_dirty "dirty")
  endif ()
elseif (GIT_FOUND)
  set(configure_code "
if (IS_DIRECTORY \"${sprokit_source_dir}/.git\")
  set(SPROKIT_BUILT_FROM_GIT TRUE)

  execute_process(
    COMMAND           \"${GIT_EXECUTABLE}\"
                      rev-parse
                      HEAD
    WORKING_DIRECTORY \"${sprokit_source_dir}\"
    RESULT_VARIABLE   git_return
    OUTPUT_VARIABLE   sprokit_git_hash)
  execute_process(
    COMMAND           \"${GIT_EXECUTABLE}\"
                      rev-parse
                      --short
                      HEAD
    WORKING_DIRECTORY \"${sprokit_source_dir}\"
    RESULT_VARIABLE   git_return
    OUTPUT_VARIABLE   sprokit_git_hash_short)
  execute_process(
    COMMAND           \"${GIT_EXECUTABLE}\"
                      diff
                      --no-ext-diff
                      --quiet
                      --exit-code
    WORKING_DIRECTORY \"${sprokit_source_dir}\"
    RESULT_VARIABLE   git_return)

  string(STRIP \"\${sprokit_git_hash}\" sprokit_git_hash)
  string(STRIP \"\${sprokit_git_hash_short}\" sprokit_git_hash_short)

  if (git_return)
    set(sprokit_git_dirty \"dirty\")
  endif ()

  message(STATUS \"version: \${sprokit_version}\")
  message(STATUS \"git hash: \${sprokit_git_hash}\")
  message(STATUS \"git short hash: \${sprokit_git_hash_short}\")
  message(STATUS \"git dirty: \${sprokit_git_dirty}\")
endif ()
")
else ()
  set(sprokit_git_hash       "<unknown>")
  set(sprokit_git_hash_short "<unknown>")
  set(sprokit_git_dirty      "<unknown>")
endif ()
{'fraction_non_alphanumeric': 0.1179184824403999, 'fraction_numerical': 0.0, 'mean_word_length': 2.646728971962617, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2821337', 'n_tokens_mistral': 1452, 'n_tokens_neox': 1383, 'n_words': 221}