Skip to content

Commit

Permalink
Merge pull request #10 from Kpler/perf/git-branch-linearity/add-targe…
Browse files Browse the repository at this point in the history
…t-branch-option-v2

feat(git-branch-linearity): add support to main or master target bran…
  • Loading branch information
gmocquet authored Jun 17, 2021
2 parents 3e421e0 + fefa14e commit a9c284d
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 a9c284d

Please sign in to comment.