Skip to content

Commit 8512a88

Browse files
committed
Adopt sha256Checksum property in RepositorySpecifier.fileSystemIdentifier
1 parent 0bd6a54 commit 8512a88

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Sources/SourceControl/Repository.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ public struct RepositorySpecifier: Hashable, Codable {
2626
/// unique for each repository.
2727
public var fileSystemIdentifier: String {
2828
// Use first 8 chars of a stable hash.
29-
let hash = SHA256().hash(url).hexadecimalRepresentation
30-
let suffix = hash.dropLast(hash.count - 8)
29+
let suffix = ByteString(encodingAsUTF8: url).sha256Checksum.prefix(8)
3130

32-
return basename + "-" + suffix
31+
return "\(basename)-\(suffix)"
3332
}
3433

3534
/// Returns the cleaned basename for the specifier.

0 commit comments

Comments
 (0)