mirror of
https://github.com/grdl/git-get.git
synced 2026-02-07 16:24:15 +00:00
Rename git package to repo package
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package print
|
||||
|
||||
import (
|
||||
"git-get/pkg/git"
|
||||
"git-get/pkg/repo"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -9,22 +9,22 @@ type DumpPrinter struct{}
|
||||
|
||||
// Print generates a list of repos URLs. Each line contains a URL and, if applicable, a currently checked out branch name.
|
||||
// It's a way to dump all repositories managed by git-get and is supposed to be consumed by `git get --dump`.
|
||||
func (p *DumpPrinter) Print(_ string, repos []*git.Repo) string {
|
||||
func (p *DumpPrinter) Print(_ string, repos []*repo.Repo) string {
|
||||
var str strings.Builder
|
||||
|
||||
for i, repo := range repos {
|
||||
remotes, err := repo.Remotes()
|
||||
for i, r := range repos {
|
||||
remotes, err := r.Remotes()
|
||||
if err != nil || len(remotes) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
// TODO: Needs work. Right now we're just assuming the first remote is the origin one and the one from which the current branch is checked out.
|
||||
url := remotes[0].Config().URLs[0]
|
||||
current := repo.Status.CurrentBranch
|
||||
current := r.Status.CurrentBranch
|
||||
|
||||
str.WriteString(url)
|
||||
|
||||
if current != git.StatusDetached && current != git.StatusUnknown {
|
||||
if current != repo.StatusDetached && current != repo.StatusUnknown {
|
||||
str.WriteString(" " + current)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user