mirror of
https://github.com/NixOS/nix
synced 2025-07-05 20:41:47 +02:00
Merge remote-tracking branch 'origin/master' into large-path-warning
This commit is contained in:
commit
54a9fbe5d6
9 changed files with 103 additions and 35 deletions
|
@ -50,21 +50,14 @@ bool Hash::operator == (const Hash & h2) const
|
|||
}
|
||||
|
||||
|
||||
bool Hash::operator != (const Hash & h2) const
|
||||
std::strong_ordering Hash::operator <=> (const Hash & h) const
|
||||
{
|
||||
return !(*this == h2);
|
||||
}
|
||||
|
||||
|
||||
bool Hash::operator < (const Hash & h) const
|
||||
{
|
||||
if (hashSize < h.hashSize) return true;
|
||||
if (hashSize > h.hashSize) return false;
|
||||
if (auto cmp = algo <=> h.algo; cmp != 0) return cmp;
|
||||
if (auto cmp = hashSize <=> h.hashSize; cmp != 0) return cmp;
|
||||
for (unsigned int i = 0; i < hashSize; i++) {
|
||||
if (hash[i] < h.hash[i]) return true;
|
||||
if (hash[i] > h.hash[i]) return false;
|
||||
if (auto cmp = hash[i] <=> h.hash[i]; cmp != 0) return cmp;
|
||||
}
|
||||
return false;
|
||||
return std::strong_ordering::equivalent;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -86,19 +86,14 @@ private:
|
|||
|
||||
public:
|
||||
/**
|
||||
* Check whether two hash are equal.
|
||||
* Check whether two hashes are equal.
|
||||
*/
|
||||
bool operator == (const Hash & h2) const;
|
||||
|
||||
/**
|
||||
* Check whether two hash are not equal.
|
||||
* Compare how two hashes are ordered.
|
||||
*/
|
||||
bool operator != (const Hash & h2) const;
|
||||
|
||||
/**
|
||||
* For sorting.
|
||||
*/
|
||||
bool operator < (const Hash & h) const;
|
||||
std::strong_ordering operator <=> (const Hash & h2) const;
|
||||
|
||||
/**
|
||||
* Returns the length of a base-16 representation of this hash.
|
||||
|
|
|
@ -171,16 +171,16 @@ std::string fixGitURL(const std::string & url)
|
|||
std::regex scpRegex("([^/]*)@(.*):(.*)");
|
||||
if (!hasPrefix(url, "/") && std::regex_match(url, scpRegex))
|
||||
return std::regex_replace(url, scpRegex, "ssh://$1@$2/$3");
|
||||
else {
|
||||
if (url.find("://") == std::string::npos) {
|
||||
return (ParsedURL {
|
||||
.scheme = "file",
|
||||
.authority = "",
|
||||
.path = url
|
||||
}).to_string();
|
||||
} else
|
||||
return url;
|
||||
if (hasPrefix(url, "file:"))
|
||||
return url;
|
||||
if (url.find("://") == std::string::npos) {
|
||||
return (ParsedURL {
|
||||
.scheme = "file",
|
||||
.authority = "",
|
||||
.path = url
|
||||
}).to_string();
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
// https://www.rfc-editor.org/rfc/rfc3986#section-3.1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue