mirror of
https://github.com/Stunkymonkey/dotfiles.git
synced 2026-01-29 09:23:02 +01:00
Fix hard coded master/main branch on git-ard
As previous change, but now for git-ard, too
This commit is contained in:
parent
837517dad7
commit
48ef0a52d1
1 changed files with 4 additions and 11 deletions
|
|
@ -5,19 +5,12 @@
|
|||
# Enforce being in a git repository
|
||||
git rev-parse --is-inside-work-tree >/dev/null || exit $?
|
||||
|
||||
# We actually should check out the head branch via `git remote show ${REMOTE}`,
|
||||
# but this requires active connection and active 2FA verification. Tedious to
|
||||
# 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)"
|
||||
GIT_REMOTE=origin
|
||||
|
||||
HEAD_REMOT="$(git rev-parse --abbrev-ref ${GIT_REMOTE}/HEAD | cut -d/ -f2)"
|
||||
HEAD_LOCAL="$(git rev-parse --abbrev-ref HEAD)"
|
||||
|
||||
# Show the next command
|
||||
set -x
|
||||
|
||||
git range-diff "${GIT_REMOTE}/${MAIN_BRANCH}..${GIT_REMOTE}/${CURRENT_BRANCH}" "${MAIN_BRANCH}..${CURRENT_BRANCH}"
|
||||
git range-diff "${GIT_REMOTE}/${HEAD_REMOT}..${GIT_REMOTE}/${HEAD_LOCAL}" "${HEAD_REMOT}..${HEAD_LOCAL}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue