Skip to content

Commit

Permalink
Fixed error names
Browse files Browse the repository at this point in the history
  • Loading branch information
regexident committed Apr 27, 2020
1 parent 538dc24 commit 7dd4ca5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Sources/Pathspec/GitIgnoreSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import Foundation
struct GitIgnoreSpec: Spec {
enum Error: Swift.Error {
case emptyPattern
case containsPoundPrefix
case containsTrippleStar
case commented
case invalid
case emptyRoot
}

Expand All @@ -24,9 +24,9 @@ struct GitIgnoreSpec: Spec {
self.pattern = pattern

guard !pattern.isEmpty else { throw Error.emptyPattern }
guard !pattern.hasPrefix("#") else { throw Error.containsPoundPrefix }
guard !pattern.contains("***") else { throw Error.containsTrippleStar }
guard pattern != "/" else { throw Error.emptyPattern }
guard !pattern.hasPrefix("#") else { throw Error.commented }
guard !pattern.contains("***") else { throw Error.invalid }
guard pattern != "/" else { throw Error.emptyRoot }

var pattern = pattern
if pattern.hasPrefix("!") {
Expand Down

0 comments on commit 7dd4ca5

Please sign in to comment.