Skip to content
This repository was archived by the owner on Feb 3, 2018. It is now read-only.

Commit 4815cd5

Browse files
committed
Defer ListVersions() on already-fetched git repos
This was causing potentially unnecessary network activity, as well as placing a block that effectively serialized slow points in the solving algorithm.
1 parent e4435f5 commit 4815cd5

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

maybe_source.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,11 @@ func (m maybeGitSource) try(cachedir string, an ProjectAnalyzer) (source, string
8282
}
8383

8484
src.baseVCSSource.lvfunc = src.listVersions
85-
86-
_, err = src.listVersions()
87-
if err != nil {
88-
return nil, "", err
85+
if !r.CheckLocal() {
86+
_, err = src.listVersions()
87+
if err != nil {
88+
return nil, "", err
89+
}
8990
}
9091

9192
return src, ustr, nil
@@ -129,10 +130,11 @@ func (m maybeGopkginSource) try(cachedir string, an ProjectAnalyzer) (source, st
129130
}
130131

131132
src.baseVCSSource.lvfunc = src.listVersions
132-
133-
_, err = src.listVersions()
134-
if err != nil {
135-
return nil, "", err
133+
if !r.CheckLocal() {
134+
_, err = src.listVersions()
135+
if err != nil {
136+
return nil, "", err
137+
}
136138
}
137139

138140
return src, ustr, nil

source_manager.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ func (sm *SourceMgr) DeduceProjectRoot(ip string) (ProjectRoot, error) {
305305
}
306306

307307
func (sm *SourceMgr) getSourceFor(id ProjectIdentifier) (source, error) {
308-
//pretty.Println(id.ProjectRoot)
309308
nn := id.netName()
310309

311310
sm.srcmut.RLock()

0 commit comments

Comments
 (0)