Skip to content

Commit b85b88e

Browse files
committed
fix(scp): keep tilde in local paths by using _filedir instead of _expand
Do not replace `~` by `/home/user/` for local files to get behavior consistent with other tools like `ls`. I hope, dropping `_expand` and adding `_filedir` to have file name completion will not cause issues like [Ville Skyttä \[Bash-completion-devel\] `_expand`, scp and quoting](https://alioth-lists-archive.debian.net/pipermail/bash-completion-devel/2009-February/000973.html) when a patch intended to fix [Debian #521406. bash-completion: leading tilde always expanded](https://bugs.debian.org/521406) was reverted.
1 parent 730368b commit b85b88e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

completions/ssh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,6 @@ _scp()
557557
;;
558558
esac
559559

560-
_expand || return
561-
562560
case $cur in
563561
!(*:*)/* | [.~]*) ;; # looks like a path
564562
*:*)
@@ -581,7 +579,8 @@ _scp()
581579
return
582580
;;
583581
*/* | [.~]*)
584-
# not a known host, pass through
582+
# not a known host
583+
_filedir
585584
;;
586585
*)
587586
_known_hosts_real ${ipvx-} -c -a \

0 commit comments

Comments
 (0)