Add support for when the base branch is called master
```git-check-assertions run ./test/git-check-assertions.bats assert_success ```
This commit is contained in:
parent
e495aa826e
commit
9ecec1ee6d
1 changed files with 9 additions and 1 deletions
|
|
@ -64,7 +64,15 @@ export -f run assert_success assert_failure assert_output
|
||||||
|
|
||||||
# main flow
|
# main flow
|
||||||
orig_ref="$(git symbolic-ref --quiet --short HEAD || git rev-parse HEAD)"
|
orig_ref="$(git symbolic-ref --quiet --short HEAD || git rev-parse HEAD)"
|
||||||
base="$(git merge-base main HEAD)"
|
if git show-ref --verify --quiet refs/heads/main; then
|
||||||
|
base_branch=main
|
||||||
|
elif git show-ref --verify --quiet refs/heads/master; then
|
||||||
|
base_branch=master
|
||||||
|
else
|
||||||
|
echo "No main or master branch found." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
base="$(git merge-base "$base_branch" HEAD)"
|
||||||
mapfile -t commits < <(git rev-list --reverse "${base}..HEAD")
|
mapfile -t commits < <(git rev-list --reverse "${base}..HEAD")
|
||||||
|
|
||||||
echo "Base: $base"
|
echo "Base: $base"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue