File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,8 @@ func RemoteForCurrentBranch() (string, error) {
116
116
return remote , nil
117
117
}
118
118
119
- // RemoteRefForCurrentBranch returns the full remote ref (remote/remotebranch) that the current branch is tracking
119
+ // RemoteRefForCurrentBranch returns the full remote ref (refs/remotes/{remote}/{remotebranch})
120
+ // that the current branch is tracking.
120
121
func RemoteRefNameForCurrentBranch () (string , error ) {
121
122
ref , err := CurrentRef ()
122
123
if err != nil {
@@ -134,7 +135,7 @@ func RemoteRefNameForCurrentBranch() (string, error) {
134
135
135
136
remotebranch := RemoteBranchForLocalBranch (ref .Name )
136
137
137
- return remote + "/" + remotebranch , nil
138
+ return fmt . Sprintf ( "refs/remotes/%s/%s" , remote , remotebranch ) , nil
138
139
}
139
140
140
141
// RemoteForBranch returns the remote name that a given local branch is tracking (blank if none)
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ func TestCurrentRefAndCurrentRemoteRef(t *testing.T) {
66
66
67
67
refname , err := RemoteRefNameForCurrentBranch ()
68
68
assert .Equal (t , nil , err )
69
- assert .Equal (t , "origin/someremotebranch" , refname )
69
+ assert .Equal (t , "refs/remotes/ origin/someremotebranch" , refname )
70
70
71
71
remote , err := RemoteForCurrentBranch ()
72
72
assert .Equal (t , nil , err )
You can’t perform that action at this time.
0 commit comments