lazygit/scripts/check_for_fixups.sh
Stefan Haller 891362dfb2 Use extended regex rather than perl regex in the git call
My local git is not compiled with PCRE support, so using -E makes it easier for
me to test the script locally. And -E is good enough for the simple matching we
want to do here.
2024-07-13 15:02:34 +02:00

25 lines
563 B
Bash
Executable file

#!/bin/sh
base_ref=$1
# Determine the base commit
base_commit=$(git merge-base HEAD origin/"$base_ref")
# Check if base_commit is set correctly
if [ -z "$base_commit" ]; then
echo "Failed to determine base commit."
exit 1
fi
echo "Base commit: $base_commit"
# Get commits with "fixup!" in the message from base_commit to HEAD
commits=$(git log -i -E --grep "fixup\!" --format="%h %s" "$base_commit..HEAD")
if [ -z "$commits" ]; then
echo "No fixup commits found."
exit 0
else
echo "Fixup commits found:"
echo "$commits"
exit 1
fi