Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes a bug where install and restore use different paths when specifying a project spec on a HTTP link #1054

Merged
merged 1 commit into from
Sep 11, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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