We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 3e421e0 + fefa14e commit a9c284dCopy full SHA for a9c284d
1 file changed
git-branch-linearity.sh
@@ -1,10 +1,10 @@
1
#!/bin/sh
2
3
-if [ "$(git branch --list main)" ]; then TARGET_BRANCH="main"; else TARGET_BRANCH="master"; fi
4
-
+git fetch origin main:refs/remotes/origin/main 2> /dev/null
+if [ $? -eq 0 ]; then TARGET_BRANCH="main"; else TARGET_BRANCH="master"; fi
5
echo "Target branch: $TARGET_BRANCH"
6
-out=$(git log origin/${TARGET_BRANCH}..HEAD --merges --oneline)
7
+out=$(git log origin/${TARGET_BRANCH}..HEAD --merges --oneline)
8
exit_status=$?
9
if [ -n "$out" ]
10
then
@@ -13,7 +13,7 @@ then
13
echo "\nMerge commit(s):" >&2
14
echo "$out" >&2
15
# Disclaimer: current version of the check doesn't work well with release branches
16
-exit_status=1
+ exit_status=1
17
fi
18
19
exit ${exit_status}
0 commit comments