aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-07-14 15:22:52 +0200
committerGitHub <noreply@github.com>2020-07-14 15:22:52 +0200
commit298ff6af8f38cefe148cc049b136b665245d6c49 (patch)
treecbbaf28e05ad2013d463a58a858bb82bbcf363aa /src
parentda3aea291da2519e54cb897c5b3ca02eb00d688c (diff)
parentcf9f33995bb0e992b84ade84b3ffa659eab1a9d8 (diff)
Merge pull request #3809 from Ma27/gitlab-refs
Fix gitlab-fetcher to obtain tags and branches
Diffstat (limited to 'src')
-rw-r--r--src/libfetchers/github.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libfetchers/github.cc b/src/libfetchers/github.cc
index 4c1a140ff..8bb7c2c1d 100644
--- a/src/libfetchers/github.cc
+++ b/src/libfetchers/github.cc
@@ -229,13 +229,13 @@ struct GitLabInputScheme : GitArchiveInputScheme
Hash getRevFromRef(nix::ref<Store> store, const Input & input) const override
{
auto host_url = maybeGetStrAttr(input.attrs, "url").value_or("gitlab.com");
- auto url = fmt("https://%s/api/v4/projects/%s%%2F%s/repository/branches/%s",
+ auto url = fmt("https://%s/api/v4/projects/%s%%2F%s/repository/commits?ref_name=%s",
host_url, getStrAttr(input.attrs, "owner"), getStrAttr(input.attrs, "repo"), *input.getRef());
auto json = nlohmann::json::parse(
readFile(
store->toRealPath(
downloadFile(store, url, "source", false).storePath)));
- auto rev = Hash(std::string(json["commit"]["id"]), htSHA1);
+ auto rev = Hash(std::string(json[0]["id"]), htSHA1);
debug("HEAD revision for '%s' is %s", url, rev.gitRev());
return rev;
}