feat(gix-url): add path access without query or fragment - #2983
Merged
Conversation
Sebastian Thiel (Byron)
force-pushed
the
gix-url-no-query-params
branch
from
September 9, 2026 06:42
a90497b to
41296e0
Compare
<!-- agent --> Expose the decoded path, query pairs, and fragment of Git remote URLs separately. Consumers can identify repository paths and inspect HTTP(S) parameters without implementing scheme-specific splitting and decoding. Recognize delimiters before decoding and reuse validated original spelling to borrow decoded bytes. Preserve encoded separators, nested escapes, ordered duplicate query keys, and literal percent text after construction or mutation. Query pairs use form decoding (`+` becomes space); SSH/SCP paths, existing accessors, and serialization keep their behavior. Reference Git's `connect.c::parse_connect_url()` and `url.c` at `1630431f326e`. Use `fetch-pack --diag-url` to check SSH delimiters; standalone `url-parse` does not model that transport. Assisted-by: GPT 6.0 Co-authored-by: GPT 6.0 <[email protected]>
Sebastian Thiel (Byron)
force-pushed
the
gix-url-no-query-params
branch
from
September 9, 2026 09:00
41296e0 to
cd90fe1
Compare
Sebastian Thiel (Byron)
marked this pull request as ready for review
September 9, 2026 14:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tasks
This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.
Everything below this line was generated by
Codex GPT-6.Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
GitButler needs a repository path without HTTP query or fragment text, while preserving encoded path characters. Add
Url::path_without_query_and_fragment() -> &BStr:https://host/repo%23one?query=value#fragmentnow exposes/repo#onethrough this accessor.The method locates literal HTTP/HTTPS delimiters in the validated original spelling and borrows the corresponding decoded bytes from
Url::path. Nested escapes are decoded once, empty HTTP paths return/, and constructed or mutated paths follow the existing serialization rules without decoding literal percent text again. Other schemes retain their stored path, including SSH delimiters and SCP-style percent escapes. The addition preservesUrl::path,original_path(), serialization, and the Serde representation.GitButler example
In
RemoteUrl::parse(), the scheme-dependent split-and-decode block can become:Forge-specific owner/repository extraction and terminal
.gitstripping stay with GitButler;example.github.io.gitremains intact in the accessor.Validation
Regressions were written first and reproduced the unwanted suffixes before the implementation. They cover both HTTP schemes, encoded delimiters, nested and multibyte escapes, empty paths, construction, stale cached spelling, scheme changes, arbitrary path bytes, SSH/SCP, and repository names containing
.git.GIX_TEST_IGNORE_ARCHIVES=1 cargo test -p gix-url --features gix-testtools/sha1 --test url access::path_without_query_and_fragment— 4 passed.GIX_TEST_IGNORE_ARCHIVES=1 cargo test -p gix-url --features serde,gix-testtools/sha1— 20 unit tests, 147 integration tests, and 2 doctests passed.cargo fmt --all -- --checkandgit diff --check— passed.cargo clippy -p gix-url --all-targets --features serde,gix-testtools/sha1 -- -D warnings -A unknown-lints --no-deps— passed; Rust 1.98.1 reports the workspace's existing removed-lint configuration warning.RUSTDOCFLAGS='-D warnings' cargo doc -p gix-url --features serde --no-deps— passed.codex review --commit a90497beedd8f849c03ae9448ae7ad8ada81cfce— no actionable defects.Git reference
Inspected
connect.c::parse_connect_url()in/Users/byron/dev/github.com/git/gitat1630431f326e15fcde608827b5ff38422528eb59. Its existing binary identifies as2.55.0.windows.4.17.g15c6308cf7.dirty;fetch-pack --diag-urlconfirms/repo#one?twofor the SSH URL andrepo#one?two%23threefor SCP syntax, with nested escapes also decoded once. The standaloneurl-parse -c pathreturns/repofor these delimiter examples, so it was not used as the SSH transport oracle.Reported issue
User-provided report (verbatim)