Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions pb/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"net/url"
"path/filepath"
"reflect"
"strings"
)
Expand Down Expand Up @@ -120,6 +121,14 @@ func ParseRepositoryInfo(input string) (*RepositoryInfo, error) {
return ParseRepositoryInfo("https://" + input)
}

if u.Scheme == "file" {
return &RepositoryInfo{
CloneURL: input,
FullName: u.Path,
Copy link
Contributor

@carlosms carlosms Nov 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about adding also Name: filepath.Base(u.Path)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Name: filepath.Base(u.Path),
}, nil
}

if u.Scheme != "https" {
return nil, fmt.Errorf("only https urls are supported")
}
Expand Down
8 changes: 8 additions & 0 deletions pb/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ func TestParseRepositoryInfo(t *testing.T) {
Name: "bar",
},
},
{
Input: "file:///some/path/to/repo",
Expected: RepositoryInfo{
CloneURL: "file:///some/path/to/repo",
FullName: "/some/path/to/repo",
Name: "repo",
},
},
}

errorCases := []struct {
Expand Down