2023-07-07 10:08:50 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# Try to detect if the current repo has a main branch, or master.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if git branch -l | grep -q "main"; then
|
2023-09-14 19:46:28 +00:00
|
|
|
>&2 echo "mainbranch: selected branch main"
|
|
|
|
sleep 0.5
|
2023-07-07 10:08:50 +00:00
|
|
|
echo "main"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if git branch -l | grep -q "master"; then
|
2023-09-14 19:46:28 +00:00
|
|
|
>&2 echo "mainbranch: selected branch master"
|
|
|
|
sleep 0.5
|
2023-07-07 10:08:50 +00:00
|
|
|
echo "master"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 1
|