carapace-bin icon indicating copy to clipboard operation
carapace-bin copied to clipboard

git: Filename completion with directory symlinks

Open saviola777 opened this issue 9 months ago • 3 comments

Current Behavior

When there's a symlink anywhere in the directory hierarchy to the current directory, filename completion will create a relative path to the symlink target, effectively breaking filename completion.

Expected Behavior

Completion should work for the current directory regardless of whether there's a symlink anywhere in the directory hierarchy.

Steps To Reproduce

With the default config:

mkdir /tmp/a
ln -s /tmp/a /tmp/b
cd /tmp/b
git clone <some repo> test
cd test
touch some_file
git add som<Tab> # will not offer completion
git add <Tab> # will complete to ../../a/test/some_file

Version

1.0.1

OS

  • [X] Linux
  • [ ] OSX
  • [ ] Windows

Shell

  • [ ] Bash
  • [ ] Elvish
  • [ ] Fish
  • [ ] Nushell
  • [ ] Oil
  • [ ] Powershell
  • [ ] Xonsh
  • [X] Zsh

Anything else?

No response

saviola777 avatar Apr 25 '24 08:04 saviola777

I can imagine that there's still something amiss with symlinks. But following the given example it does complete some_file for me for both cases.

rsteube avatar Apr 25 '24 09:04 rsteube

Thanks for the feedback, maybe it's something in my configuration / environment that's the issue, I'll try to see if I can identify it.

saviola777 avatar Apr 25 '24 09:04 saviola777

One thing to note is that git add <file> is different from standard file completion and only completes relevant files.

rsteube avatar Apr 25 '24 09:04 rsteube