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

Gitlab hostname only support. #699

Merged
merged 3 commits into from
May 18, 2022

Conversation

Bene81
Copy link
Contributor

@Bene81 Bene81 commented May 13, 2022

Closes #698 .

This merge request offers support for addressing git hosts by hostname only.

The overall idea of this implementation is: if a host uri does not contain any dots it has to be a host in the local network.
If thats the case the resulting credential scope is returned.

Otherwise the old scope determination algorithm applies.
UnitTest has been adapted. I am open for discussions or improvement suggestions.

Bene81 added 2 commits May 13, 2022 19:39
	modified:       src/shared/Core.Tests/UriExtensionsTests.cs
Copy link
Contributor

@ldennington ldennington left a comment

Choose a reason for hiding this comment

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

Thank you for opening this PR! 🎉 I've added a few suggestions for cleanup, but looks good overall.

Co-authored-by: Lessley Dennington <[email protected]>
@Bene81
Copy link
Contributor Author

Bene81 commented May 18, 2022

Thanks for your suggestions. I have reviewed and applied them.
Just for my personal understanding: why is it guarenteed that the URL hostname/domain name is either null or whitespace but never string.Empty?

@Bene81 Bene81 marked this pull request as ready for review May 18, 2022 19:33
@Bene81 Bene81 marked this pull request as draft May 18, 2022 19:37
@Bene81 Bene81 marked this pull request as ready for review May 18, 2022 19:40
@Bene81 Bene81 requested a review from ldennington May 18, 2022 19:44
@mjcheetham
Copy link
Collaborator

mjcheetham commented May 18, 2022

why is it guarenteed that the URL hostname/domain name is either null or whitespace but never string.Empty?

The string.IsNullOrWhiteSpace method also checks for the empty string, and is therefore a superset of the tests used in string.IsNullOrEmpty. C# documentation

Value string.IsNullOrEmpty string.IsNullOrWhiteSpace
"foo" false false
null true true
""
string.Empty
true true
" " false true

I.e, the empty string is also considered whitespace.

@Bene81
Copy link
Contributor Author

Bene81 commented May 18, 2022

Thanks for hinting. Sorry, should have figured that out myself.

@ldennington ldennington merged commit 731f2db into git-ecosystem:main May 18, 2022
@Bene81 Bene81 deleted the gitlab-hostname-only branch May 19, 2022 04:49
@ldennington ldennington mentioned this pull request Jun 15, 2022
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.

GitLabHostProvider ignoring gitlab hosts if addressed by hostname only.
3 participants