Skip to content

Commit

Permalink
Merge pull request #12 from WanderaOrg/performance-improvement
Browse files Browse the repository at this point in the history
Use shallow clones in order to save time & Bandwidth
  • Loading branch information
coufalja authored Jul 17, 2018
2 parents 016b92a + 9d2be48 commit 08bf646
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/fetch/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func (f *fetcher) Fetch() (*object.Commit, error) {
URL: f.url,
Auth: f.auth,
NoCheckout: true,
Depth: 1,
ReferenceName: plumbing.ReferenceName(fmt.Sprintf("refs/heads/%s", f.branch)),
})
if err != nil {
Expand All @@ -62,7 +63,8 @@ func (f *fetcher) Fetch() (*object.Commit, error) {

log.Info("Fetching changes")
err = r.Fetch(&git.FetchOptions{
Auth: f.auth,
Auth: f.auth,
Depth: 1,
})
if err != nil && err != git.NoErrAlreadyUpToDate {
log.Errorf("Failed to fetch remote changes: %v", err)
Expand All @@ -73,7 +75,7 @@ func (f *fetcher) Fetch() (*object.Commit, error) {
if err != nil {
return nil, err
}
localRef, err := r.Reference(plumbing.ReferenceName("HEAD"), true)
localRef, err := r.Head()
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 08bf646

Please sign in to comment.