| 339 | } |
| 340 | |
| 341 | std::optional<LsRemoteRefLine> parseLsRemoteLine(std::string_view line) |
| 342 | { |
| 343 | const static std::regex line_regex("^(ref: *)?([^\\s]+)(?:\\t+(.*))?$"); |
| 344 | std::match_results<std::string_view::const_iterator> match; |
| 345 | if (!std::regex_match(line.cbegin(), line.cend(), match, line_regex)) |
| 346 | return std::nullopt; |
| 347 | |
| 348 | return LsRemoteRefLine{ |
| 349 | .kind = match[1].length() == 0 ? LsRemoteRefLine::Kind::Object : LsRemoteRefLine::Kind::Symbolic, |
| 350 | .target = match[2], |
| 351 | .reference = match[3].length() == 0 ? std::nullopt : std::optional<std::string>{match[3]}}; |
| 352 | } |
| 353 | |
| 354 | } // namespace nix::git |
no outgoing calls
no test coverage detected