8000 refs: honor REFSPEC_SHORTHAND for multi-segment refs by roberth · Pull Request #7148 · libgit2/libgit2 · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@roberth
Copy link
Contributor
@roberth roberth commented Oct 15, 2025

GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND is documented to "interpret the name as part of a refspec in shorthand form so the ONELEVEL naming rules aren't enforced and 'master' becomes a valid name."

However, the multi-segment pseudoref check was not respecting this flag, rejecting valid refspecs like "A/b" and "HEAD/feature" even when SHORTHAND was set.

The single-segment check at line 1015 already honors this flag. This change makes the multi-segment check at line 1021 consistent with that behavior and with the documented intent.

Git itself accepts these refspec patterns without issue.

In Nix we've applied a workaround instead (NixOS/nix#14253) but this still seems to be a problem in libgit2.

GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND is documented to "interpret the
name as part of a refspec in shorthand form so the ONELEVEL naming rules
aren't enforced and 'master' becomes a valid name."

However, the multi-segment pseudoref check was not respecting this flag,
rejecting valid refspecs like "A/b" and "HEAD/feature" even when
SHORTHAND was set.

The single-segment check at line 1015 already honors this flag. This
change makes the multi-segment check at line 1021 consistent with that
behavior and with the documented intent.

Git itself accepts these refspec patterns without issue.
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

0