Skip to content

Commit 313ce90

Browse files
committed
Use constant to replace strings
1 parent efc90b5 commit 313ce90

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

repo_branch.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (repo *Repository) SetDefaultBranch(name string) error {
5858
return ErrUnsupportedVersion{"1.7.10"}
5959
}
6060

61-
_, err := NewCommand("symbolic-ref", "HEAD", "refs/heads/"+name).RunInDir(repo.Path)
61+
_, err := NewCommand("symbolic-ref", "HEAD", BRANCH_PREFIX+name).RunInDir(repo.Path)
6262
return err
6363
}
6464

@@ -76,7 +76,7 @@ func (repo *Repository) GetBranches() ([]string, error) {
7676
if len(fields) != 2 {
7777
continue // NOTE: I should believe git will not give me wrong string.
7878
}
79-
branches[i] = strings.TrimPrefix(fields[1], "refs/heads/")
79+
branches[i] = strings.TrimPrefix(fields[1], BRANCH_PREFIX)
8080
}
8181
return branches, nil
8282
}

0 commit comments

Comments
 (0)