Skip to content

Commit

Permalink
feat(git-branch-linearity): add support to main or master target bran…
Browse files Browse the repository at this point in the history
…ch v2
  • Loading branch information
Guillaume MOCQUET committed Jun 17, 2021
1 parent 3e421e0 commit fefa14e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions git-branch-linearity.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/sh

if [ "$(git branch --list main)" ]; then TARGET_BRANCH="main"; else TARGET_BRANCH="master"; fi

git fetch origin main:refs/remotes/origin/main 2> /dev/null
if [ $? -eq 0 ]; then TARGET_BRANCH="main"; else TARGET_BRANCH="master"; fi
echo "Target branch: $TARGET_BRANCH"
out=$(git log origin/${TARGET_BRANCH}..HEAD --merges --oneline)

out=$(git log origin/${TARGET_BRANCH}..HEAD --merges --oneline)
exit_status=$?
if [ -n "$out" ]
then
Expand All @@ -13,7 +13,7 @@ then
echo "\nMerge commit(s):" >&2
echo "$out" >&2
# Disclaimer: current version of the check doesn't work well with release branches
exit_status=1
exit_status=1
fi

exit ${exit_status}

0 comments on commit fefa14e

Please sign in to comment.