mirror of
https://github.com/NixOS/nix
synced 2025-06-27 12:41:15 +02:00
readHead(): Make sure we're returning the HEAD ref line
If we previously fetched by revision, the output of "git ls-remote" won't start with the expected line like ref: refs/heads/master HEAD but will be something like 5c4410e3b9891c05ab40d723de78c6f0be45ad30 refs/heads/5c4410e3b9891c05ab40d723de78c6f0be45ad30 This then causes Nix to treat that revision as a refname, which then leads to warnings like warning: could not update cached head '5c4410e3b9891c05ab40d723de78c6f0be45ad30' for 'file:///tmp/repo'
This commit is contained in:
parent
ee9fa0d360
commit
c8b22643ba
1 changed files with 1 additions and 1 deletions
|
@ -69,7 +69,7 @@ std::optional<std::string> readHead(const Path & path)
|
||||||
|
|
||||||
std::string_view line = output;
|
std::string_view line = output;
|
||||||
line = line.substr(0, line.find("\n"));
|
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) {
|
switch (parseResult->kind) {
|
||||||
case git::LsRemoteRefLine::Kind::Symbolic:
|
case git::LsRemoteRefLine::Kind::Symbolic:
|
||||||
debug("resolved HEAD ref '%s' for repo '%s'", parseResult->target, path);
|
debug("resolved HEAD ref '%s' for repo '%s'", parseResult->target, path);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue