Skip to content

Commit

Permalink
Merge pull request #84 from ibaned/quoted-subject
Browse files Browse the repository at this point in the history
Sanitize quoted subject lines
  • Loading branch information
markdewing authored Jan 18, 2018
2 parents b3b8ef7 + aa33d89 commit b06dc99
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ IF (GIT_FOUND AND IS_GIT_PROJECT)
#
# Apparently custom commands need to be defined where the output is used.
# If this in the main CMakeLists.txt it does not work.

ADD_CUSTOM_COMMAND(
OUTPUT ${GITREV_TMP}
COMMAND ${CMAKE_COMMAND} -E echo_append "#define GIT_BRANCH_RAW " > ${GITREV_TMP}
Expand All @@ -50,9 +51,9 @@ IF (GIT_FOUND AND IS_GIT_PROJECT)
COMMAND ${CMAKE_COMMAND} -E echo_append "#define GIT_COMMIT_LAST_CHANGED_RAW " >> ${GITREV_TMP}
COMMAND ${GIT_EXECUTABLE} log -1 --format=%ad >> ${GITREV_TMP}
COMMAND ${CMAKE_COMMAND} -E echo >> ${GITREV_TMP}
COMMAND ${CMAKE_COMMAND} -E echo_append "#define GIT_COMMIT_SUBJECT_RAW " >> ${GITREV_TMP}
COMMAND ${GIT_EXECUTABLE} log -1 --format="%s" >> ${GITREV_TMP}
COMMAND ${CMAKE_COMMAND} -E echo >> ${GITREV_TMP}
COMMAND ${CMAKE_COMMAND} -E echo_append "#define GIT_COMMIT_SUBJECT_RAW \"" >> ${GITREV_TMP}
COMMAND ${GIT_EXECUTABLE} log -1 --format=%s | sed -E "s/\"/\\\\\"/g" | tr -d '\\n' >> ${GITREV_TMP}
COMMAND ${CMAKE_COMMAND} -E echo_append "\"" >> ${GITREV_TMP}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GITREV_TMP} ${GITREV_FILE}
COMMAND ${CMAKE_COMMAND} -E remove ${GITREV_TMP}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
Expand Down

0 comments on commit b06dc99

Please sign in to comment.