Skip to content

Commit

Permalink
[PackageGraph] Cleanup .git suffix stripping (#1580)
Browse files Browse the repository at this point in the history
  • Loading branch information
aciidgh committed May 22, 2018
1 parent 5d54a8c commit 6983434
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
1 change: 0 additions & 1 deletion Sources/PackageGraph/RawPackageConstraints.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import PackageModel
import PackageDescription4
import SourceControl

extension PackageDescription4.Package.Dependency {
/// Create the package reference object for the dependency.
Expand Down
9 changes: 3 additions & 6 deletions Sources/PackageGraph/RepositoryPackageContainerProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import Basic
import PackageLoading
import PackageModel
import SourceControl
import class PackageDescription4.Package
import Utility

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

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

return String(lastComponent).lowercased()
return lastComponent.lowercased()
}

/// The identity of the package.
Expand Down

0 comments on commit 6983434

Please sign in to comment.