update-bash: avoid shellout for stripping prefix

This commit is contained in:
Xu Cheng 2016-01-20 20:29:47 +08:00
parent 83e1373376
commit 9cd2658073

View File

@ -54,8 +54,8 @@ repo_var() {
upstream_branch() {
local upstream_branch
upstream_branch="$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null |
sed -e 's|refs/remotes/origin/||' )"
upstream_branch="$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null)"
upstream_branch="${upstream_branch#refs/remotes/origin/}"
[[ -z "$upstream_branch" ]] && upstream_branch="master"
echo "$upstream_branch"
}