summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Allen <michael@michaelallen.io>2015-03-09 10:56:09 +0000
committerMichael Allen <michael@michaelallen.io>2015-03-09 10:56:09 +0000
commit0472c724b11f89365aa0ef86fa794f367c7372f7 (patch)
treeb692160446def349e3986b7345f1d0a74035c56d
parent97caa1dce8f040e1eb217e6dda91a15d596a6615 (diff)
downloadgit-sonar-0472c724b11f89365aa0ef86fa794f367c7372f7.tar.gz
git-sonar-0472c724b11f89365aa0ef86fa794f367c7372f7.zip
quieten fatal remote_branch_name calls
-rwxr-xr-xgit-base.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/git-base.sh b/git-base.sh
index baed750..000b184 100755
--- a/git-base.sh
+++ b/git-base.sh
@@ -122,7 +122,8 @@ readable_branch_name() {
}
remote_branch_name() {
- local remoteBranch="$(git for-each-ref --format='%(upstream:short)' refs/heads "$(git symbolic-ref -q HEAD)" )"
+ local localRef="$(git symbolic-ref -q HEAD 2>/dev/null)"
+ local remoteBranch="$(git for-each-ref --format='%(upstream:short)' refs/heads $localRef )"
if [[ -n $remoteBranch ]]; then
echo $remoteBranch
return 0