1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

Merge remote-tracking branch 'origin/master' into lfs

This commit is contained in:
Eelco Dolstra 2025-02-10 14:46:01 +01:00
commit 1cb9a354fb
61 changed files with 921 additions and 478 deletions

View file

@ -69,7 +69,7 @@ std::optional<std::string> readHead(const Path & path)
std::string_view line = output;
line = line.substr(0, line.find("\n"));
if (const auto parseResult = git::parseLsRemoteLine(line)) {
if (const auto parseResult = git::parseLsRemoteLine(line); parseResult && parseResult->reference == "HEAD") {
switch (parseResult->kind) {
case git::LsRemoteRefLine::Kind::Symbolic:
debug("resolved HEAD ref '%s' for repo '%s'", parseResult->target, path);
@ -467,8 +467,14 @@ struct GitInputScheme : InputScheme
url);
}
repoInfo.location = std::filesystem::absolute(url.path);
} else
} else {
if (url.scheme == "file")
/* Query parameters are meaningless for file://, but
Git interprets them as part of the file name. So get
rid of them. */
url.query.clear();
repoInfo.location = url;
}
// If this is a local directory and no ref or revision is
// given, then allow the use of an unclean working tree.
@ -613,16 +619,16 @@ struct GitInputScheme : InputScheme
try {
auto fetchRef =
getAllRefsAttr(input)
? "refs/*"
? "refs/*:refs/*"
: input.getRev()
? input.getRev()->gitRev()
: ref.compare(0, 5, "refs/") == 0
? ref
? fmt("%1%:%1%", ref)
: ref == "HEAD"
? ref
: "refs/heads/" + ref;
: fmt("%1%:%1%", "refs/heads/" + ref);
repo->fetch(repoUrl.to_string(), fmt("%s:%s", fetchRef, fetchRef), getShallowAttr(input));
repo->fetch(repoUrl.to_string(), fetchRef, getShallowAttr(input));
} catch (Error & e) {
if (!std::filesystem::exists(localRefFile)) throw;
logError(e.info());