Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ __git_ps1_show_upstream ()
{
local key value
local svn_remote svn_url_pattern count n
local upstream=git legacy="" verbose=""
local upstream=git upstream_path="" legacy="" verbose=""

svn_remote=()
# get some config options from git-config
Expand Down Expand Up @@ -142,9 +142,18 @@ __git_ps1_show_upstream ()
svn_upstream=${svn_upstream#${svn_remote[$n]}}
done

upstream_path="$(
expr "$svn_upstream" : ".*/\(tags/.*\)"
)$(
expr "$svn_upstream" : ".*branches/\(.*\)"
)$(
expr "$svn_upstream" : ".*/\(trunk\)"
)"
if [[ -z "$svn_upstream" ]]; then
# default branch name for checkouts with no layout:
upstream=${GIT_SVN_ID:-git-svn}
elif [[ -n "$upstream_path" ]]; then
upstream=$upstream_path
else
upstream=${svn_upstream#/}
fi
Expand Down