github fetcher: Don't use HEAD branch when cloning

Fixes #4394.
This commit is contained in:
Eelco Dolstra 2021-09-14 13:38:45 +02:00
parent d72d31d529
commit 07996c4810

View file

@ -275,7 +275,7 @@ struct GitHubInputScheme : GitArchiveInputScheme
auto host = maybeGetStrAttr(input.attrs, "host").value_or("github.com");
Input::fromURL(fmt("git+https://%s/%s/%s.git",
host, getStrAttr(input.attrs, "owner"), getStrAttr(input.attrs, "repo")))
.applyOverrides(input.getRef().value_or("HEAD"), input.getRev())
.applyOverrides(input.getRef(), input.getRev())
.clone(destDir);
}
};
@ -343,7 +343,7 @@ struct GitLabInputScheme : GitArchiveInputScheme
// FIXME: get username somewhere
Input::fromURL(fmt("git+https://git@%s/%s/%s.git",
host, getStrAttr(input.attrs, "owner"), getStrAttr(input.attrs, "repo")))
.applyOverrides(input.getRef().value_or("HEAD"), input.getRev())
.applyOverrides(input.getRef(), input.getRev())
.clone(destDir);
}
};