Describe the bug
This bug seems to require a few things to occur:
- CDPATH must be set
- The parameter being completed must be the full name of a directory in the current directory
- No other directory is a valid completion
To reproduce
$ CDPATH=.
$ cd /
$ cd usr[TAB][TAB]
usr/ usr//
Expected behavior
Should have completed to cd bin/
Versions (please complete the following information)
Additional context
This bug is in git but not in the distribution package. It appears to be a regression from commit ed0ae10 (the bug does not occur in its parent).
Commenting out this section appears to make the issue go away (although I don't understand what it is for):
if ((${#_cdpaths[@]} == 1)); then
_p=${_cdpaths[0]}
if [[ $_p == "$cur" && $_p != */ ]]; then
_cdpaths[0]=$_p/
fi
fi
Debug trace