fix: address code review — error-path tests, edge cases, UX improvements

This commit is contained in:
2026-06-10 18:20:54 +08:00
parent 493775cd1e
commit 8d16fabaed
6 changed files with 77 additions and 10 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ func parseRemoteBranches(buf []byte) []string {
var branches []string
sc := bufio.NewScanner(bytes.NewReader(buf))
for sc.Scan() {
line := sc.Text()
line := strings.TrimSpace(sc.Text())
if idx := strings.Index(line, "\trefs/heads/"); idx >= 0 {
name := line[idx+len("\trefs/heads/"):]
if name != "" {
+1 -1
View File
@@ -8,7 +8,7 @@ import (
func TestParseRemoteBranches(t *testing.T) {
t.Parallel()
input := []byte("aabbccdd\trefs/heads/main\n" +
input := []byte("aabbccdd\trefs/heads/main\r\n" +
"eeff0011\trefs/heads/develop\n" +
"22334455\trefs/heads/feature/foo\n" +
"deadbeef\trefs/tags/v1.0\n")