summaryrefslogtreecommitdiffstats
path: root/radar-base.sh
diff options
context:
space:
mode:
Diffstat (limited to 'radar-base.sh')
-rwxr-xr-xradar-base.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/radar-base.sh b/radar-base.sh
index 9652fe1..f11d3ae 100755
--- a/radar-base.sh
+++ b/radar-base.sh
@@ -214,15 +214,18 @@ branch_ref() {
}
remote_branch_name() {
- local localRef="\/$(branch_name)$"
- if [[ -n "$localRef" ]]; then
- local remoteBranch="$(git for-each-ref --format='%(upstream:short)' refs/heads $localRef 2>/dev/null | grep $localRef)"
+ local localRef="$(branch_name)"
+ local remote="$(git config --get "branch.$localRef.remote")"
+ if [[ -n $remote ]]; then
+ local remoteBranch="$(git config --get "branch.${localRef}.merge" | sed -e 's/^refs\/heads\///')"
if [[ -n $remoteBranch ]]; then
- printf '%s' $remoteBranch
+ printf '%s/%s' $remote $remoteBranch
return 0
else
- return 1
+ return 1
fi
+ else
+ return 1
fi
}