Skip to content

UPSTREAM PR #2436: Fix ls-refs ref-prefix'ing#22

Open
loci-dev wants to merge 2 commits intomainfrom
loci/pr-2436-fintohaps-fix-ls-refs-prefixing
Open

UPSTREAM PR #2436: Fix ls-refs ref-prefix'ing#22
loci-dev wants to merge 2 commits intomainfrom
loci/pr-2436-fintohaps-fix-ls-refs-prefixing

Conversation

@loci-dev
Copy link
Copy Markdown

Note

Source pull request: GitoxideLabs/gitoxide#2436

See discussion at GitoxideLabs/gitoxide#2429

I didn't quite have the correct environment set up, so I'm not sure if all the tests are passing, but let's see if CI catches anything I messed up :)

The previous implementation would find the prefix that would include
`refs/` and the next component.

This can be too strict for namespaced references, i.e. `refs/namespaces/*`.

This change follows the same approach as the C implementation of Git.
It takes the prefix as the whole reference up to the `*`.
If there is no `*`, if it starts with `refs/`, take the whole reference.
Otherwise, there is no prefix.
The `RefPrefixes` type captures the intent of building a set of
`ref-prefix` arguments for the ls-refs protocol.

Since refspecs are the natural type that these are built from, as seen
in `handshake/mod.rs`, a constructor is provided in the form of
`RefPrefixes::from_refspecs`.

For other, external API users `RefSpecs::new` and `RefSpecs::extend`
are provided.
@loci-dev loci-dev force-pushed the main branch 5 times, most recently from 1a1cf0a to f045646 Compare February 25, 2026 07:50
@loci-dev loci-dev force-pushed the main branch 2 times, most recently from e746ced to fe5de3e Compare March 4, 2026 07:46
@loci-dev loci-dev force-pushed the main branch 4 times, most recently from 2c4a72b to 167bdd1 Compare March 13, 2026 07:48
@loci-dev loci-dev force-pushed the main branch 3 times, most recently from 9b41e5f to 1f13824 Compare March 21, 2026 07:44
@loci-dev loci-dev force-pushed the main branch 8 times, most recently from 06bc48e to 0e47b1e Compare March 30, 2026 07:05
@loci-dev loci-dev force-pushed the main branch 2 times, most recently from 8b02847 to 1bf0519 Compare April 2, 2026 07:54
@loci-dev loci-dev force-pushed the main branch 3 times, most recently from cdbe120 to 78a7ab5 Compare April 11, 2026 07:49
@loci-dev loci-dev force-pushed the main branch 6 times, most recently from 49231d8 to bc0a777 Compare April 20, 2026 07:18
@loci-dev loci-dev force-pushed the main branch 4 times, most recently from e902b63 to c6739bc Compare April 27, 2026 07:26
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.

2 participants