Skip to content

Commit 4c4d227

Browse files
committed
build-info : fix newlines correctly
Why call 'echo' and then strip the newline from its output?
1 parent fd64695 commit 4c4d227

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

scripts/build-info.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
BUILD_NUMBER="0"
44
BUILD_COMMIT="unknown"
55

6-
REV_LIST=$(git rev-list --count HEAD)
6+
# git is broken on WSL so we need to strip extra newlines
7+
REV_LIST=$(git rev-list --count HEAD | tr -d '\n')
78
if [ $? -eq 0 ]; then
89
BUILD_NUMBER=$REV_LIST
910
fi
1011

11-
REV_PARSE=$(git rev-parse --short HEAD)
12+
REV_PARSE=$(git rev-parse --short HEAD | tr -d '\n')
1213
if [ $? -eq 0 ]; then
1314
BUILD_COMMIT=$REV_PARSE
1415
fi
1516

1617
echo "#ifndef BUILD_INFO_H"
1718
echo "#define BUILD_INFO_H"
18-
echo ""
19-
echo "#define BUILD_NUMBER $BUILD_NUMBER" | tr -d '\n'
20-
echo ""
21-
echo "#define BUILD_COMMIT \"$BUILD_COMMIT\"" | tr -d '\n'
22-
echo ""
19+
echo
20+
echo "#define BUILD_NUMBER $BUILD_NUMBER"
21+
echo "#define BUILD_COMMIT \"$BUILD_COMMIT\""
22+
echo
2323
echo "#endif // BUILD_INFO_H"

0 commit comments

Comments
 (0)