Skip to content

Fix ls-refs ref-prefix'ing#2436

Open
FintanH wants to merge 2 commits intoGitoxideLabs:mainfrom
FintanH:fintohaps/fix-ls-refs-prefixing
Open

Fix ls-refs ref-prefix'ing#2436
FintanH wants to merge 2 commits intoGitoxideLabs:mainfrom
FintanH:fintohaps/fix-ls-refs-prefixing

Conversation

@FintanH
Copy link
Contributor

@FintanH FintanH commented Feb 15, 2026

See discussion at #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.
@FintanH FintanH force-pushed the fintohaps/fix-ls-refs-prefixing branch from 84d2dae to 485006d Compare February 15, 2026 17:33
Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 84d2daec19

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

/// using `agent` information to identify ourselves.
pub fn new(
prefix_refspecs: Option<&[gix_refspec::RefSpec]>,
prefix_refspecs: Option<RefPrefixes>,
Copy link
Contributor

Choose a reason for hiding this comment

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

P1 Badge Keep LsRefsCommand::new usable from downstream crates

LsRefsCommand::new now takes Option<RefPrefixes>, but RefPrefixes lives in gix_protocol::ls_refs::function and that module is pub(crate) (and not re-exported), so external callers cannot construct Some(...) anymore. In practice, downstream code can only pass None, which silently removes the public ability to configure ref-prefix filtering through this API and is a source-breaking regression for users that previously passed refspec-based filters.

Useful? React with 👍 / 👎.

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.
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.

1 participant