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

Fix username retrieval #45

Merged
merged 4 commits into from
Sep 3, 2023
Merged

Conversation

gifnksm
Copy link
Contributor

@gifnksm gifnksm commented Sep 3, 2023

Fixes #42, #44

@gifnksm gifnksm changed the title Fix-username-retrieval Fix username retrieval Sep 3, 2023
src/lib.rs Outdated
@@ -132,14 +121,15 @@ impl CredentialHandler {
// handle this we bail out of this authentication session after setting
// the flag `ssh_username_requested`, and then we handle this below.
if allowed.contains(git2::CredentialType::USERNAME) {
// debug_assert!(username.is_none());
debug_assert!(username.is_none());
Copy link
Owner

Choose a reason for hiding this comment

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

I don't want the lib to panic if username is defined. Can you comment the statement again or handle this case differently?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for reviewing!

fixed by a2ee307

Comment on lines 131 to 134
if key.as_str().eq_ignore_ascii_case(name) {
let path = value.as_str().to_string();

// trace!("found IdentityFile option with value {:?}", path);
Copy link
Owner

Choose a reason for hiding this comment

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

As you modify the function (and this part) to not only retrieve a path of IdentityFile, can you also rename the variable path to reflect this change eg found_value).

Maybe in the future, an optimisation will be to not parse the file for every search.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed by c140c67

@codecov-commenter
Copy link

codecov-commenter commented Sep 3, 2023

Codecov Report

Merging #45 (c140c67) into master (5640b82) will increase coverage by 1.95%.
Report is 2 commits behind head on master.
The diff coverage is 100.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master      #45      +/-   ##
==========================================
+ Coverage   87.38%   89.34%   +1.95%     
==========================================
  Files           2        2              
  Lines         111      122      +11     
==========================================
+ Hits           97      109      +12     
+ Misses         14       13       -1     
Files Changed Coverage Δ
src/lib.rs 89.74% <ø> (+3.07%) ⬆️
src/ssh_config.rs 89.15% <100.00%> (+1.50%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@gifnksm gifnksm requested a review from davidB September 3, 2023 14:02
@davidB davidB merged commit bf39d78 into davidB:master Sep 3, 2023
5 checks passed
@davidB
Copy link
Owner

davidB commented Sep 3, 2023

I release your fix as part of version 0.12.1 (for git2 0.17) and 0.13.0 (for git2 0.18).

Thank you.

@gifnksm gifnksm deleted the fix-username-retrieval branch September 4, 2023 08:41
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.

Retrieve username from ssh_config
3 participants