Skip to content

Commit

Permalink
Merge pull request #1054 from colinbull/master
Browse files Browse the repository at this point in the history
Fixes a bug where install and restore use different paths when specifying a project spec on a HTTP link
  • Loading branch information
forki committed Sep 11, 2015
2 parents b2d449a + 580c275 commit c64e0b3
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/Paket.Core/LockFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ module LockFileSerializer =

let path = file.Name.TrimStart '/'
match String.IsNullOrEmpty(file.Commit) with
| false -> yield sprintf " %s (%s)" path file.Commit
| false ->
match origin with
| HttpLink _ when not(String.IsNullOrEmpty(file.Project)) ->
yield sprintf " %s %s (%s)" file.Project path file.Commit
| _ -> yield sprintf " %s (%s)" path file.Commit
| true -> yield sprintf " %s" path

for (PackageName name,v) in file.Dependencies do
Expand Down Expand Up @@ -246,16 +250,20 @@ module LockFileParser =
| HttpLink x ->
match state.RemoteUrl |> Option.map(fun s -> s.Split '/' |> Array.toList) with
| Some [ protocol; _; domain; ] ->
let name, path =
let project, name, path =
match details.Split ' ' with
| [| filePath; path |] -> filePath, path |> removeBrackets
| [| filePath; path |] -> "", filePath, path |> removeBrackets
| [| project; filePath; path |] -> project, filePath, path |> removeBrackets
| _ -> failwith "invalid file source details."

let removeInvalidChars (str:string) =
System.Text.RegularExpressions.Regex.Replace(str, "[:@\,]", "_")

let sourceFile =
{ Commit = path
Owner = domain
Owner = domain |> removeInvalidChars
Origin = HttpLink(state.RemoteUrl.Value)
Project = ""
Project = project
Dependencies = Set.empty
Name = name }

Expand Down

0 comments on commit c64e0b3

Please sign in to comment.