File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,19 @@ if [ -z "${__GIT_PROMPT_DIR}" ]; then
19
19
__GIT_PROMPT_DIR=" $( cd -P " $( dirname " ${SOURCE} " ) " && pwd ) "
20
20
fi
21
21
22
+ if [[ " ${__GIT_PROMPT_WITH_USERNAME_AND_REPO} " == " 1" ]]; then
23
+ # returns "user/repo" from remote.origin.url git variable
24
+ #
25
+ # supports urls:
26
+ # https://[email protected] /user/repo.git
27
+ # https://github.com/user/repo.git
28
+
29
+ #
30
+ remote_url=$( git config --get remote.origin.url | sed ' s|^.*//||; s/.*@//; s/[^:/]\+[:/]//; s/.git$//' )
31
+ else
32
+ remote_url=' .'
33
+ fi
34
+
22
35
gitsym=$( git symbolic-ref HEAD 2> /dev/null )
23
36
24
37
# If exit status OK, we have a branch
99
112
fi
100
113
else
101
114
remote=' _NO_REMOTE_TRACKING_'
115
+ remote_url=' .'
102
116
unset upstream
103
117
fi
104
118
fi
@@ -111,9 +125,10 @@ if [[ -z "$upstream" ]] ; then
111
125
upstream=' ^'
112
126
fi
113
127
114
- printf " %s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
128
+ printf " %s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n " \
115
129
" $branch " \
116
130
" $remote " \
131
+ " $remote_url " \
117
132
" $upstream " \
118
133
$num_staged \
119
134
$num_conflicts \
You can’t perform that action at this time.
0 commit comments