Skip to content

Commit a9c284d

Browse files
authored
Merge pull request #10 from Kpler/perf/git-branch-linearity/add-target-branch-option-v2
feat(git-branch-linearity): add support to main or master target bran…
2 parents 3e421e0 + fefa14e commit a9c284d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

git-branch-linearity.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/bin/sh
22

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

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

1919
exit ${exit_status}

0 commit comments

Comments
 (0)