Skip to content

fix: username in scp-like url is no longer percent-encoded (#2056) #2060

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 2 commits into from
Jun 26, 2025

Conversation

yuja
Copy link
Contributor

@yuja yuja commented Jun 25, 2025

Since Git doesn't percent-decode characters in scp-like URL, we shouldn't encode username at all.

https://github.com/git/git/blob/v2.50.0/connect.c#L1081

I've split write_to() function to clarify that any non-path components that should be separated by ":" cannot be serialized in alternative form. I've made it fall back to the URL syntax if password or port number was set. Maybe we can also check if the user or host includes ":", but I'm not sure how much foolproof we should add here.

…abs#2056)

Since Git doesn't percent-decode characters in scp-like URL, we shouldn't encode
username at all.

https://github.com/git/git/blob/v2.50.0/connect.c#L1081

I've split write_to() function to clarify that any non-path components that
should be separated by ":" cannot be serialized in alternative form. I've made
it fall back to the URL syntax if password or port number was set. Maybe we can
also check if the user or host includes ":", but I'm not sure how much foolproof
we should add here.
@Byron
Copy link
Member

Byron commented Jun 26, 2025

Thanks so much, I am loving the refactoring and the tests for the additional logic improvements.

Since I dug into the baseline test a little bit I noticed that we are still not parsing everything that Git can correctly. If the baseline could be brought to greater compatibility, maybe then it's just another small step to assure we can serialize everything correctly as well. Maybe something for @rickprice - taking many small steps would lead to a positive outcome here.

However, these don't show any differences as we already parsed these
correctly, while the recent changes have been about serialization.
@Byron Byron force-pushed the push-urolxnurwtsn branch from 75de0e7 to 212b618 Compare June 26, 2025 03:30
@Byron Byron enabled auto-merge June 26, 2025 03:30
@Byron Byron merged commit 68d761c into GitoxideLabs:main Jun 26, 2025
23 checks passed
@yuja yuja deleted the push-urolxnurwtsn branch June 26, 2025 07:32
@rickprice
Copy link
Contributor

rickprice commented Jun 27, 2025 via email

@Byron
Copy link
Member

Byron commented Jun 28, 2025

Thanks for offering!

However, I don't think there were new tests added to the URL related Git test-suite, and I believe there is a lot to work on before trying to find more. The baseline tests have over 100 failures right now, i.e. Git parsing URLs that we can't parse or parse incorrectly. Thus, in gix-url there might be a lot of low-hanging fruit to pick by getting it to be more compliant.

@rickprice
Copy link
Contributor

rickprice commented Jul 3, 2025

Okay, I will try running the tests and see if I can start fixing things. For the moment, that is what I will focus on to try and help the project out.

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