commands/command_migrate.go: simplify formatRefName()

Since 'formatRefName()' no longer has multiple case statements, let's
simplify the body to use an `if`, instead.

Co-authored-by: brian m. carlson <bk2204@github.com>
This commit is contained in:
Taylor Blau 2018-09-25 14:31:36 -07:00
parent ceb1842d3e
commit 3421b7292e

@ -279,15 +279,11 @@ func getRemoteRefs(l *tasklog.Logger) (map[string][]*git.Ref, error) {
// formatRefName returns the fully-qualified name for the given Git reference
// "ref".
func formatRefName(ref *git.Ref, remote string) string {
var name []string
switch ref.Type {
case git.RefTypeRemoteBranch:
name = []string{"refs", "remotes", remote, ref.Name}
default:
return ref.Refspec()
if ref.Type == git.RefTypeRemoteBranch {
return strings.Join([]string{
"refs", "remotes", remote, ref.Name}, "/")
}
return strings.Join(name, "/")
return ref.Refspec()
}