Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

transport: make Endpoint an interface, fixes #362 #365

Merged
merged 1 commit into from
Apr 27, 2017
Merged

transport: make Endpoint an interface, fixes #362 #365

merged 1 commit into from
Apr 27, 2017

Conversation

smola
Copy link
Collaborator

@smola smola commented Apr 27, 2017

  • add internal *url.URL implementation for regular URLs.
  • add internal implementation for SCP-like URLs.

User() string
// Password returns the password or an empty string if none is given.
Password() string
// User returns the user or an empty string if none is given.
Copy link
Contributor

Choose a reason for hiding this comment

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

copypasta typo.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍 done

scpLikeUrlRegExp = regexp.MustCompile("^(?:(?P<user>[^@]+)@)?(?P<host>[^:]+):/?(?P<path>.+)$")
)

func parseSCPLike(endpoint string) Endpoint {
Copy link
Contributor

@alcortesm alcortesm Apr 27, 2017

Choose a reason for hiding this comment

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

Returning (Endpoint, bool) would be more idiomatic, so it can be used like:

path := "foo/bar"
if e, ok := parseSCPLike(path) ; ok {
    return e, nil
}
// try other formats...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍 done

Copy link
Contributor

@ajnavarro ajnavarro left a comment

Choose a reason for hiding this comment

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

After check @alcortesm comments, approved for me.

* add internal *url.URL implementation for regular URLs.
* add internal implementation for SCP-like URLs.
@codecov
Copy link

codecov bot commented Apr 27, 2017

Codecov Report

Merging #365 into master will decrease coverage by 0.56%.
The diff coverage is 79.26%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #365      +/-   ##
==========================================
- Coverage   77.28%   76.71%   -0.57%     
==========================================
  Files         122      122              
  Lines        8518     8555      +37     
==========================================
- Hits         6583     6563      -20     
- Misses       1198     1268      +70     
+ Partials      737      724      -13
Impacted Files Coverage Δ
plumbing/transport/ssh/common.go 0% <0%> (-56.15%) ⬇️
plumbing/transport/git/common.go 70.73% <100%> (+0.73%) ⬆️
plumbing/transport/client/client.go 100% <100%> (ø) ⬆️
remote.go 69.61% <100%> (ø) ⬆️
plumbing/transport/http/upload_pack.go 77.08% <100%> (ø) ⬆️
plumbing/transport/file/client.go 100% <100%> (ø) ⬆️
plumbing/transport/server/loader.go 100% <100%> (ø) ⬆️
plumbing/transport/ssh/auth_method.go 32.4% <14.28%> (-25.69%) ⬇️
plumbing/transport/http/common.go 76% <66.66%> (+5.62%) ⬆️
plumbing/transport/common.go 93.33% <94.11%> (+2.85%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 64cd72d...45bdbcb. Read the comment docs.

@smola smola merged commit a548013 into src-d:master Apr 27, 2017
@smola smola deleted the git-rel-path branch April 27, 2017 15:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants