build-info : fix newlines correctly

Why call 'echo' and then strip the newline from its output?
This commit is contained in:
Cebtenzzre 2023-09-03 13:49:29 -04:00
parent 045718f07a
commit b1593bc17c

View file

@ -3,21 +3,21 @@
BUILD_NUMBER="0"
BUILD_COMMIT="unknown"
REV_LIST=$(git rev-list --count HEAD)
# git is broken on WSL so we need to strip extra newlines
REV_LIST=$(git rev-list --count HEAD | tr -d '\n')
if [ $? -eq 0 ]; then
BUILD_NUMBER=$REV_LIST
fi
REV_PARSE=$(git rev-parse --short HEAD)
REV_PARSE=$(git rev-parse --short HEAD | tr -d '\n')
if [ $? -eq 0 ]; then
BUILD_COMMIT=$REV_PARSE
fi
echo "#ifndef BUILD_INFO_H"
echo "#define BUILD_INFO_H"
echo ""
echo "#define BUILD_NUMBER $BUILD_NUMBER" | tr -d '\n'
echo ""
echo "#define BUILD_COMMIT \"$BUILD_COMMIT\"" | tr -d '\n'
echo ""
echo
echo "#define BUILD_NUMBER $BUILD_NUMBER"
echo "#define BUILD_COMMIT \"$BUILD_COMMIT\""
echo
echo "#endif // BUILD_INFO_H"