fetch from default branch when branch isn't specified
This commit is contained in:
parent
cadf72646c
commit
f8f0a5e36e
2 changed files with 5 additions and 7 deletions
|
|
@ -67,10 +67,7 @@ class Repo:
|
|||
self.file = "default.nix"
|
||||
else:
|
||||
self.file = file_
|
||||
if branch is None:
|
||||
self.branch = "master"
|
||||
else:
|
||||
self.branch = branch
|
||||
self.branch = branch
|
||||
self.locked_version = None
|
||||
|
||||
if (
|
||||
|
|
@ -155,7 +152,7 @@ def load_manifest(manifest_path: PathType, lock_path: PathType) -> Manifest:
|
|||
for name, repo in data["repos"].items():
|
||||
url = urlparse(repo["url"])
|
||||
submodules = repo.get("submodules", False)
|
||||
branch_ = repo.get("branch", "master")
|
||||
branch_ = repo.get("branch")
|
||||
file_ = repo.get("file", "default.nix")
|
||||
type_ = repo.get("type", None)
|
||||
locked_version = locked_versions.get(name)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class GitPrefetcher:
|
|||
|
||||
def latest_commit(self) -> str:
|
||||
data = subprocess.check_output(
|
||||
["git", "ls-remote", self.repo.url.geturl(), self.repo.branch],
|
||||
["git", "ls-remote", self.repo.url.geturl(), self.repo.branch or "HEAD"],
|
||||
env={**os.environ, "GIT_ASKPASS": "", "GIT_TERMINAL_PROMPT": "0"},
|
||||
)
|
||||
return data.decode().split(maxsplit=1)[0]
|
||||
|
|
@ -35,7 +35,8 @@ class GitPrefetcher:
|
|||
cmd = ["nix-prefetch-git"]
|
||||
if self.repo.submodules:
|
||||
cmd += ["--fetch-submodules"]
|
||||
cmd += ["--rev", f"refs/heads/{self.repo.branch}"]
|
||||
if self.repo.branch:
|
||||
cmd += ["--rev", f"refs/heads/{self.repo.branch}"]
|
||||
cmd += [self.repo.url.geturl()]
|
||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue