1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-23 12:18:51 +02:00
lazygit/scripts/check_for_fixups.sh
Stefan Haller 20ccb03a45 Extend check for fixups
Also check for squash! and amend! (these are all anchored to the beginning of
the subject), and WIP and DROPME for good measure (but only if they occur in the
first line, otherwise it wouldn't let me merge this very commit :)
2024-07-13 15:15:01 +02:00

26 lines
648 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!' --grep '^squash!' --grep '^amend!' --grep '^[^\n]*WIP' --grep '^[^\n]*DROPME' --format="%h %s" "$base_commit..HEAD")
if [ -z "$commits" ]; then
echo "No fixup commits found."
exit 0
else
echo "Fixup or WIP commits found:"
echo "$commits"
exit 1
fi