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

update transport Command interface to support SetAuth after creation #210

Merged
merged 2 commits into from
Jan 17, 2017

Conversation

amlweems
Copy link
Contributor

Reworks Command interface to split the session creation into two components: general object create & session connect. This allows an external caller to create the session, call SetAuth(), and then perform the network connection. This network connection is "baked" in to the other interface functions to keep the external interface the same.

Addresses #206.

@codecov-io
Copy link

codecov-io commented Jan 14, 2017

Current coverage is 76.28% (diff: 61.90%)

Merging #210 into master will decrease coverage by 0.55%

@@             master       #210   diff @@
==========================================
  Files            96         96          
  Lines          6278       6299    +21   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits           4824       4805    -19   
- Misses          925        971    +46   
+ Partials        529        523     -6   

Powered by Codecov. Last update cbcbe03...9f6a9d0

@mcuadros mcuadros requested a review from smola January 15, 2017 17:54
Copy link
Collaborator

@smola smola left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

@@ -46,6 +46,8 @@ type Commander interface {
type Command interface {
// SetAuth sets the authentication method.
SetAuth(transport.AuthMethod) error
// Perform the actual network connection.
Connect() error
Copy link
Collaborator

Choose a reason for hiding this comment

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

SetAuth is actually a leftover from a previous implementation that should have been gone. Auth can only be set before connection and we don't support reusing commands or connections at all.

So, instead of adding a new Connect function, I think it would be better to just remove SetAuth from all interfaces (Command, Session) and add transport.AuthMethod as a second parameter to NewUploadPackSession and NewReceivePackSession.

That would keep these interfaces simpler and avoid invalid sequences of function calls.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I had wondered about that. I've moved AuthMethod to the PackSession functions now.

While doing that, I noticed that server also uses these functions. I've left a TODO for now to design / implement AuthMethod for servers. I think this could be used to verify a client connection to the go-git server in the future.

@smola smola merged commit 376dc6a into src-d:master Jan 17, 2017
@amlweems amlweems deleted the auth-fix branch January 17, 2017 17:45
mcuadros pushed a commit that referenced this pull request Jan 31, 2017
* remove SetAuth functions, implement at NewUploadPackSession/NewReceivePackSession level.
* propagate transport.Auth from Fetch/Pull/Clone options to the transport API.
gsalingu-ovhus pushed a commit to gsalingu-ovhus/go-git that referenced this pull request Mar 28, 2019
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