mirror of
https://github.com/Stunkymonkey/dotfiles.git
synced 2026-01-29 01:13:01 +01:00
Fix hard coded master/main HEAD branch
This commit is contained in:
parent
b4fbe4dd12
commit
837517dad7
1 changed files with 5 additions and 13 deletions
|
|
@ -8,23 +8,15 @@
|
||||||
# Enforce being in a git repository
|
# Enforce being in a git repository
|
||||||
git rev-parse --is-inside-work-tree >/dev/null || exit $?
|
git rev-parse --is-inside-work-tree >/dev/null || exit $?
|
||||||
|
|
||||||
# We actually should check out the head branch via `git remote show ${REMOTE}`,
|
HEAD_REMOT="$(git rev-parse --abbrev-ref origin/HEAD | cut -d/ -f2)"
|
||||||
# but this requires active connection and active 2FA verification. Tedious to
|
HEAD_LOCAL="$(git rev-parse --abbrev-ref HEAD)"
|
||||||
# have multiple calls for this
|
|
||||||
if git rev-parse --verify main &>/dev/null; then
|
|
||||||
MAIN_BRANCH=main
|
|
||||||
else
|
|
||||||
MAIN_BRANCH=master
|
|
||||||
fi
|
|
||||||
|
|
||||||
CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
if [ "${HEAD_LOCAL}" = "${HEAD_REMOT}" ]; then
|
||||||
|
echo "Cannot rebase commits from '${HEAD_LOCAL}' (HEAD) onto '${HEAD_REMOT}'" >&2
|
||||||
if [ "${CURRENT_BRANCH}" = "${MAIN_BRANCH}" ]; then
|
|
||||||
echo "Cannot rebase commits from '${CURRENT_BRANCH}' (HEAD) onto '${MAIN_BRANCH}'" >&2
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MERGE_BASE="$(git merge-base "${MAIN_BRANCH}" HEAD)"
|
MERGE_BASE="$(git merge-base "${HEAD_REMOT}" HEAD)"
|
||||||
|
|
||||||
# Show the next command
|
# Show the next command
|
||||||
set -x
|
set -x
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue