Panic if tracking ref can't be reconstructed

This commit is contained in:
William Martin 2025-01-06 15:44:34 +01:00 committed by Caleb Brose
parent 3ae4e5da20
commit dc077dc09b
2 changed files with 12 additions and 16 deletions

View file

@ -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