Skip to content

Commit

Permalink
Try branch as rev when commmit hash and tag fail
Browse files Browse the repository at this point in the history
debugging more

debugging more again

debugging more again

debugging more again

Revert "debugging more again"

This reverts commit 5f71270.

Revert "debugging more again"

This reverts commit 1bd302a.

Revert "debugging more again"

This reverts commit 98dda0d.

Revert "debugging more"

This reverts commit 8330c86.

Revert "debugging"

This reverts commit c2f5b76.

add ability to try branch-name

fix original error error

set newRev correctly
  • Loading branch information
JonathanLorimer committed Feb 17, 2022
1 parent 0da5333 commit a6c45c0
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions fetch/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,25 @@ func fetchPackage(caches []map[string]*types.Package, importPath string, goPacka
"--url", repoRoot.Repo,
"--rev", newRev).Output()
if err != nil {
log.WithFields(log.Fields{
"goPackagePath": goPackagePath,
}).Error("Fetching failed")
return nil, originalErr
}

rev = newRev
log.WithFields(log.Fields{
"goPackagePath": goPackagePath,
"branch": rev,
}).Info("Fetching failed, retrying with rev as branch")
stdout, err = exec.Command(
"nix-prefetch-git",
"--quiet",
"--fetch-submodules",
"--url", repoRoot.Repo,
"--branch-name", rev).Output()
if err != nil {
log.WithFields(log.Fields{
"goPackagePath": goPackagePath,
}).Error("Fetching failed")
return nil, originalErr
}
} else {
rev = newRev
}
}

var output *prefetchOutput
Expand Down

0 comments on commit a6c45c0

Please sign in to comment.