Skip to content

Commit 6983434

Browse files
authored
[PackageGraph] Cleanup .git suffix stripping (#1580)
1 parent 5d54a8c commit 6983434

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

Sources/PackageGraph/RawPackageConstraints.swift

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import PackageModel
1212
import PackageDescription4
13-
import SourceControl
1413

1514
extension PackageDescription4.Package.Dependency {
1615
/// Create the package reference object for the dependency.

Sources/PackageGraph/RepositoryPackageContainerProvider.swift

+3-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import Basic
1414
import PackageLoading
1515
import PackageModel
1616
import SourceControl
17-
import class PackageDescription4.Package
1817
import Utility
1918

2019
/// Adaptor for exposing repositories as PackageContainerProvider instances.
@@ -110,13 +109,11 @@ public struct PackageReference: PackageContainerIdentifier, JSONMappable, JSONSe
110109
var lastComponent = packageURL.split(separator: "/", omittingEmptySubsequences: true).last!
111110

112111
// Strip `.git` suffix if present.
113-
//
114-
// FIXME: We need String() here because of https://bugs.swift.org/browse/SR-5627
115-
if String(lastComponent).hasSuffix(".git") {
116-
lastComponent = lastComponent[...lastComponent.index(lastComponent.endIndex, offsetBy: -5)]
112+
if lastComponent.hasSuffix(".git") {
113+
lastComponent = lastComponent.dropLast(4)
117114
}
118115

119-
return String(lastComponent).lowercased()
116+
return lastComponent.lowercased()
120117
}
121118

122119
/// The identity of the package.

0 commit comments

Comments
 (0)