eldritch horrors
b0d7a81613
clangd broke because it can't look through symlinks. compile_commands
manipulation does not fix it, clangd configuration does not fix it, a
vfs overlay does not fix it, and while a combination of those can fix
it with a bind mount in place that's just too cursed to even consider
clangd bug: https://github.com/llvm/llvm-project/issues/116877
Change-Id: I8e3e8489548eb3a7aa65ac9d12a5ec8abf814aec
26 lines
702 B
C++
26 lines
702 B
C++
#include "lix/libutil/git.hh"
|
|
|
|
#include <regex>
|
|
|
|
namespace nix {
|
|
namespace git {
|
|
|
|
std::optional<LsRemoteRefLine> parseLsRemoteLine(std::string_view line)
|
|
{
|
|
const static std::regex line_regex("^(ref: *)?([^\\s]+)(?:\\t+(.*))?$");
|
|
std::match_results<std::string_view::const_iterator> match;
|
|
if (!std::regex_match(line.cbegin(), line.cend(), match, line_regex))
|
|
return std::nullopt;
|
|
|
|
return LsRemoteRefLine {
|
|
.kind = match[1].length() == 0
|
|
? LsRemoteRefLine::Kind::Object
|
|
: LsRemoteRefLine::Kind::Symbolic,
|
|
.target = match[2],
|
|
.reference = match[3].length() == 0 ? std::nullopt : std::optional<std::string>{ match[3] }
|
|
};
|
|
}
|
|
|
|
}
|
|
}
|