Panic if tracking ref can't be reconstructed
This commit is contained in:
parent
3ae4e5da20
commit
dc077dc09b
2 changed files with 12 additions and 16 deletions
|
|
@ -1,7 +1,6 @@
|
|||
package git
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
|
@ -65,17 +64,6 @@ func (r TrackingRef) String() string {
|
|||
return "refs/remotes/" + r.RemoteName + "/" + r.BranchName
|
||||
}
|
||||
|
||||
func ParseTrackingRef(text string) (TrackingRef, error) {
|
||||
parts := strings.SplitN(string(text), "/", 4)
|
||||
if len(parts) != 4 {
|
||||
return TrackingRef{}, fmt.Errorf("invalid tracking ref: %s", text)
|
||||
}
|
||||
return TrackingRef{
|
||||
RemoteName: parts[2],
|
||||
BranchName: parts[3],
|
||||
}, nil
|
||||
}
|
||||
|
||||
type Commit struct {
|
||||
Sha string
|
||||
Title string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue