Skip to content

Local Transport Silently Fails on Symbolic Refs #2613

Description

Current behavior 😯

When creating a repo.remote_at("/home/user/repo") with a refspec set to +HEAD:refs/test/repo, the symbolic reference HEAD in the remote repository is not resolved. Instead, the name HEAD is resolved in the local repository, which results in refs/test/repo targeting the local HEAD.

Expected behavior 🤔

The HEAD ref (or any symbolic ref) should be resolved in the remote repository.

Git behavior

Git resolves the HEAD ref in the remote repository.

Steps to reproduce 🕹

Note

This was originally found via Claude Code (Opus 4.7) while developing git-vendor.
The demonstration linked below is originally written by Claude Code, and edited by myself for clarity.

In a scratch space...

cd /tmp

...clone a fork of this repository I've made, and run the demonstration test.

git clone --depth 1 https://github.com/jdc-pub/gitoxide.git --branch main gitoxide-demo
cd gitoxide-demo 
git checkout 8ba39778dcc9ca4b95d98e4e1a2a972e68214e1e 
cargo test -p gix --features blocking-network-client --test demo-local-transport-symref-failure

You should see the following output. (I've marked the problem-test as should panic, but it of course should not panic!)

running 3 tests
test gix_fetch_head_into_bare_local_is_correct ... ok
test git_cli_fetch_head_returns_upstream_tip ... ok
test gix_fetch_head_resolves_against_local_repo_bug - should panic ... ok

Metadata

Metadata

Assignees

No one assigned

    Labels

    acknowledgedan issue is accepted as shortcoming to be fixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions