2022-01-16 05:46:53 +02:00
|
|
|
package gui
|
|
|
|
|
2022-01-23 05:40:28 +02:00
|
|
|
import "github.com/jesseduffield/lazygit/pkg/commands/models"
|
|
|
|
|
2022-01-16 05:46:53 +02:00
|
|
|
// this file is to put things where it's not obvious where they belong while this refactor takes place
|
|
|
|
|
|
|
|
func (gui *Gui) getSuggestedRemote() string {
|
2022-01-31 13:11:34 +02:00
|
|
|
remotes := gui.State.Model.Remotes
|
2022-01-16 05:46:53 +02:00
|
|
|
|
2022-01-23 05:40:28 +02:00
|
|
|
return getSuggestedRemote(remotes)
|
|
|
|
}
|
|
|
|
|
|
|
|
func getSuggestedRemote(remotes []*models.Remote) string {
|
2022-01-16 05:46:53 +02:00
|
|
|
if len(remotes) == 0 {
|
|
|
|
return "origin"
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, remote := range remotes {
|
|
|
|
if remote.Name == "origin" {
|
|
|
|
return remote.Name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return remotes[0].Name
|
|
|
|
}
|