diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-06-18 13:25:08 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-06-18 13:25:08 +0200 |
commit | 3d492199bb9a4c78fa6e474bb5a67df72db189c7 (patch) | |
tree | 93cd34c709ee44813f2b2478196622c454d43d52 | |
parent | 5d69bbf3fe6edfc1765ea5de6ef474eae889449e (diff) |
github: Respect default branch
-rw-r--r-- | src/libfetchers/github.cc | 6 | ||||
-rw-r--r-- | tests/github-flakes.nix | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/libfetchers/github.cc b/src/libfetchers/github.cc index 12d8d346c..4c1a140ff 100644 --- a/src/libfetchers/github.cc +++ b/src/libfetchers/github.cc @@ -137,7 +137,7 @@ struct GitArchiveInputScheme : InputScheme { Input input(_input); - if (!maybeGetStrAttr(input.attrs, "ref")) input.attrs.insert_or_assign("ref", "master"); + if (!maybeGetStrAttr(input.attrs, "ref")) input.attrs.insert_or_assign("ref", "HEAD"); auto rev = input.getRev(); if (!rev) rev = getRevFromRef(store, input); @@ -217,7 +217,7 @@ struct GitHubInputScheme : GitArchiveInputScheme auto host_url = maybeGetStrAttr(input.attrs, "url").value_or("github.com"); Input::fromURL(fmt("git+ssh://git@%s/%s/%s.git", host_url, getStrAttr(input.attrs, "owner"), getStrAttr(input.attrs, "repo"))) - .applyOverrides(input.getRef().value_or("master"), input.getRev()) + .applyOverrides(input.getRef().value_or("HEAD"), input.getRev()) .clone(destDir); } }; @@ -262,7 +262,7 @@ struct GitLabInputScheme : GitArchiveInputScheme // FIXME: get username somewhere Input::fromURL(fmt("git+ssh://git@%s/%s/%s.git", host_url, getStrAttr(input.attrs, "owner"), getStrAttr(input.attrs, "repo"))) - .applyOverrides(input.getRef().value_or("master"), input.getRev()) + .applyOverrides(input.getRef().value_or("HEAD"), input.getRev()) .clone(destDir); } }; diff --git a/tests/github-flakes.nix b/tests/github-flakes.nix index 0b1f1322f..a47610d9a 100644 --- a/tests/github-flakes.nix +++ b/tests/github-flakes.nix @@ -56,7 +56,7 @@ let tar cfz $out/tarball/${nixpkgs.rev} $dir --hard-dereference mkdir -p $out/commits - echo '{"sha": "${nixpkgs.rev}"}' > $out/commits/master + echo '{"sha": "${nixpkgs.rev}"}' > $out/commits/HEAD ''; in |