diff --git a/ci/nur/manifest.py b/ci/nur/manifest.py index 346e819b6..215e0b176 100644 --- a/ci/nur/manifest.py +++ b/ci/nur/manifest.py @@ -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) diff --git a/ci/nur/prefetch.py b/ci/nur/prefetch.py index 56b321a2a..31313d791 100644 --- a/ci/nur/prefetch.py +++ b/ci/nur/prefetch.py @@ -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: