10000 v5: plumbing: transport, Reintroduce SetHostKeyCallback. Fix #1514 by pjbgf · Pull Request #1515 · go-git/go-git · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

v5: plumbing: transport, Reintroduce SetHostKeyCallback. Fix #1514 #1515

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

Merged
merged 1 commit into from
Apr 14, 2025

Conversation

pjbgf
Copy link
Member
@pjbgf pjbgf commented Apr 14, 2025

The PR #1482 renamed SetHostKeyCallback to SetHostKeyCallbackAndAlgorithms, due to the change in behaviour in that method. For keeping backwards compatibility with v5, a new SetHostKeyCallback is being introduced that simply calls back to SetHostKeyCallbackAndAlgorithms.

Some tests were introduced to enforce expected behaviour.

The PR go-git#1482 renamed SetHostKeyCallback to SetHostKeyCallbackAndAlgorithms, due to
the change in behaviour. For keeping backwards compatibility within existing v5, a
new SetHostKeyCallback is being introduced that simply calls back to
SetHostKeyCallbackAndAlgorithms.

Some tests were introduced to enforce expected behaviour.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
Copy link
Contributor
@Javier-varez Javier-varez left a comment

Choose a reason for hiding this comment

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

Thanks, I did not realize that there are users of HostKeyCallbackHelper outside go-git. Thank you for addressing it.


// fallback allows for injecting the fallback call, which is called
// when a HostKeyCallback is not set.
fallback func(files ...string) (ssh.HostKeyCallback, error)
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth indicating that this is only meant for testing, but in practice it always calls NewKnownHostsCallback

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. I was initially considered this, but given that it is already an internal field and the code may not necessarily move into v6, I ended up deciding against it.

@pjbgf pjbgf merged commit 6d4a5c6 into go-git:releases/v5.x Apr 14, 2025
12 of 13 checks passed
@pjbgf pjbgf deleted the regre branch April 14, 2025 17:01
@pjbgf pjbgf changed the title plumbing: transport, Reintroduce SetHostKeyCallback. Fix #1514 v5: plumbing: transport, Reintroduce SetHostKeyCallback. Fix #1514 Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0