<commit_before>FUNCTION(GET_FILE_VERSION FILE_NAME FILE_VERSION)

  # if we build from a git repository, we calculate the file version:
  #  Patch number is numer of commits for given file
  IF(EXISTS ${CMAKE_SOURCE_DIR}/.git)
    EXECUTE_PROCESS(COMMAND git --git-dir=${CMAKE_BINARY_DIR}/.git --work-tree=${CMAKE_SOURCE_DIR} rev-list HEAD --count -- ${FILE_NAME} 
      OUTPUT_VARIABLE FV)
    STRING(REPLACE "\n" "" FV ${FV})
    SET(${FILE_VERSION} ${FV} PARENT_SCOPE)
  ELSE()
    SET(${FILE_VERSION} 0)
  ENDIF()
ENDFUNCTION()

MACRO(SET_VERSION_INFO)
  SET(FILE_VERSION "0")
  FOREACH(PROPERTY ${ARGN})
    IF(${PROPERTY} MATCHES "TARGET:")
      STRING(REGEX REPLACE "^[TARGET:\\s]" "" TARGET ${PROPERTY})
    ELSEIF(${PROPERTY} MATCHES "FILE_TYPE:")
      STRING(REGEX REPLACE "^[FILE_TYPE:\\s]" "" FILE_TYPE ${PROPERTY})
    ELSEIF(${PROPERTY} MATCHES "ORIGINAL_FILE_NAME:")
      STRING(REGEX REPLACE "^[ORIGINAL_FILE_NAME:\\s]" "" ORIGINAL_FILE_NAME ${PROPERTY})
    ELSEIF(${PROPERTY} MATCHES "SOURCE_FILE:")
      STRING(REGEX REPLACE "^[SOURCE_FILE:\\s]" "" SOURCE ${PROPERTY})
      GET_FILE_VERSION(${SOURCE} FILE_VERSION)
    ELSEIF(${PROPERTY} MATCHES "FILE_DESCRIPTION:")
      STRING(REPLACE "FILE_DESCRIPTION:" "" FILE_DESCRIPTION ${PROPERTY})
    ENDIF()
  ENDFOREACH()
  CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/win/resource.rc.in
                 ${CMAKE_BINARY_DIR}/win/${TARGET}.rc)
  SET(${TARGET}_RC ${CMAKE_BINARY_DIR}/win/${TARGET}.rc)
ENDMACRO()


<commit_msg>Fix build outside of ${CMAKE_SOURCE_DIR}: Detecting file version failed if SOURCE != BINARY_DIR<commit_after>FUNCTION(GET_FILE_VERSION FILE_NAME FILE_VERSION)

  # if we build from a git repository, we calculate the file version:
  #  Patch number is numer of commits for given file
  IF(EXISTS ${CMAKE_SOURCE_DIR}/.git)
    EXECUTE_PROCESS(COMMAND git --git-dir=${CMAKE_SOURCE_DIR}/.git --work-tree=${CMAKE_SOURCE_DIR} rev-list HEAD --count -- ${FILE_NAME} 
      OUTPUT_VARIABLE FV)
    STRING(REPLACE "\n" "" FV ${FV})
    SET(${FILE_VERSION} ${FV} PARENT_SCOPE)
  ELSE()
    SET(${FILE_VERSION} 0)
  ENDIF()
ENDFUNCTION()

MACRO(SET_VERSION_INFO)
  SET(FILE_VERSION "0")
  FOREACH(PROPERTY ${ARGN})
    IF(${PROPERTY} MATCHES "TARGET:")
      STRING(REGEX REPLACE "^[TARGET:\\s]" "" TARGET ${PROPERTY})
    ELSEIF(${PROPERTY} MATCHES "FILE_TYPE:")
      STRING(REGEX REPLACE "^[FILE_TYPE:\\s]" "" FILE_TYPE ${PROPERTY})
    ELSEIF(${PROPERTY} MATCHES "ORIGINAL_FILE_NAME:")
      STRING(REGEX REPLACE "^[ORIGINAL_FILE_NAME:\\s]" "" ORIGINAL_FILE_NAME ${PROPERTY})
    ELSEIF(${PROPERTY} MATCHES "SOURCE_FILE:")
      STRING(REGEX REPLACE "^[SOURCE_FILE:\\s]" "" SOURCE ${PROPERTY})
      GET_FILE_VERSION(${SOURCE} FILE_VERSION)
    ELSEIF(${PROPERTY} MATCHES "FILE_DESCRIPTION:")
      STRING(REPLACE "FILE_DESCRIPTION:" "" FILE_DESCRIPTION ${PROPERTY})
    ENDIF()
  ENDFOREACH()
  CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/win/resource.rc.in
                 ${CMAKE_BINARY_DIR}/win/${TARGET}.rc)
  SET(${TARGET}_RC ${CMAKE_BINARY_DIR}/win/${TARGET}.rc)
ENDMACRO()



{'fraction_non_alphanumeric': 0.1559633027522936, 'fraction_numerical': 0.001310615989515072, 'mean_word_length': 4.540834845735027, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4858237', 'n_tokens_mistral': 1184, 'n_tokens_neox': 1105, 'n_words': 213}