mirror of
https://github.com/grdl/git-get.git
synced 2026-02-12 20:30:15 +00:00
Fix missing fetch call
This commit is contained in:
@@ -23,7 +23,7 @@ func List(c *ListCfg) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
loaded := loadAll(paths)
|
loaded := loadAll(paths, c.Fetch)
|
||||||
|
|
||||||
printables := make([]print.Printable, len(loaded))
|
printables := make([]print.Printable, len(loaded))
|
||||||
for i := range loaded {
|
for i := range loaded {
|
||||||
@@ -45,14 +45,15 @@ func List(c *ListCfg) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// loadAll runs a separate goroutine to open, fetch (if asked to) and load status of git repo
|
// loadAll runs a separate goroutine to open, fetch (if asked to) and load status of git repo
|
||||||
func loadAll(paths []string) []*Loaded {
|
func loadAll(paths []string, fetch bool) []*Loaded {
|
||||||
var ll []*Loaded
|
var ll []*Loaded
|
||||||
|
|
||||||
loadedChan := make(chan *Loaded)
|
loadedChan := make(chan *Loaded)
|
||||||
|
|
||||||
for _, path := range paths {
|
for _, path := range paths {
|
||||||
go func(path string) {
|
go func(path string) {
|
||||||
loadedChan <- Load(path)
|
|
||||||
|
loadedChan <- Load(path, fetch)
|
||||||
}(path)
|
}(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ type Loaded struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load reads status of a repository at a given path.
|
// Load reads status of a repository at a given path.
|
||||||
func Load(path string) *Loaded {
|
func Load(path string, fetch bool) *Loaded {
|
||||||
loaded := &Loaded{
|
loaded := &Loaded{
|
||||||
path: path,
|
path: path,
|
||||||
branches: make(map[string]string),
|
branches: make(map[string]string),
|
||||||
@@ -30,6 +30,13 @@ func Load(path string) *Loaded {
|
|||||||
return loaded
|
return loaded
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if fetch {
|
||||||
|
err = repo.Fetch()
|
||||||
|
if err != nil {
|
||||||
|
loaded.errors = append(loaded.errors, err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
loaded.current, err = repo.CurrentBranch()
|
loaded.current, err = repo.CurrentBranch()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
loaded.errors = append(loaded.errors, err.Error())
|
loaded.errors = append(loaded.errors, err.Error())
|
||||||
|
|||||||
Reference in New Issue
Block a user