Files @ r27870:7c06e9e1a86b
Branch filter:

Location: cpp/openttd-patchpack/source/.github/changelog.sh

Patric Stout
Fix: asserts unintentially being partially disabled in release-builds (#11268)

The nlohmann-json header file includes assert.h, which rudely resets
the assert macro to what that header thinks is right. As we set the
assert macro to be active with release builds when WITH_ASSERT is
active, this means that every file including nlohmann-json has their
asserts disabled (for release-builds) but files that don't do no.

Let's avoid this issue, by telling nlohmann to not include assert.h.
#!/bin/sh

tag=$(git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null | sed 's@\^0$@@')

# If we are a tag, show the part of the changelog till (but excluding) the last stable
if [ -n "$tag" ]; then
    grep='^[0-9]\+\.[0-9]\+[^-]'
    next=$(cat changelog.txt | grep '^[0-9]' | awk 'BEGIN { show="false" } // { if (show=="true") print $0; if ($1=="'$tag'") show="true"} ' | grep "$grep" | head -n1 | sed 's/ .*//')
    cat changelog.txt | awk 'BEGIN { show="false" } /^[0-9]+.[0-9]+/ { if ($1=="'$next'") show="false"; if ($1=="'$tag'") show="true";} // { if (show=="true") print $0 }'
    exit 0
fi

# In all other cases, show the git log of the last 7 days
revdate=$(git log -1 --pretty=format:"%ci")
last_week=$(date -d "$revdate -7days" +"%Y-%m-%d %H:%M")
git log --after="${last_week}" --pretty=fuller