Skip to content

Cannot checkout repositories with relative symlinks in them #2107

@0xDEC0DE

Description

@0xDEC0DE

Bug Description

Attempting a checkout of a repo containing a relative symlink throws an error

Steps to reproduce

go run ./_examples/clone/main.go https://github.com/lorin/openstack-ansible-modules.git ~/Desktop/lolwut

Expected result

Repository is cloned and a worktree is created at ~/Desktop/lolwut

Actual behavior

git clone https://github.com/lorin/openstack-ansible-modules.git /Users/nic/Desktop/lolwut --recursive
error: symlink: invalid path "../keystone_service": cannot use ".."
exit status 1

Miscellany

git clone https://github.com/lorin/openstack-ansible-modules.git /Users/nisimond/Desktop/lolwut --recursive
Cloning into '/Users/nic/Desktop/lolwut'...
remote: Enumerating objects: 565, done.
remote: Total 565 (delta 0), reused 0 (delta 0), pack-reused 565 (from 1)
Receiving objects: 100% (565/565), 170.64 KiB | 1.43 MiB/s, done.
Resolving deltas: 100% (304/304), done.

go-git Version

v6.0.0-20260511090450-983ee99d1198

Steps to Reproduce

go run ./_examples/clone/main.go https://github.com/lorin/openstack-ansible-modules.git ~/Desktop/lolwut

Additional Information

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions