summary refs log tree commit diff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2016-10-31 12:14:23 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2016-10-31 12:14:23 -0700
commit59dbab4f1c0898f9a354d85051b1d5a5e776d984 (patch)
tree355f23e14151650bcb23af41a64373614ddd2775
parent74aa45910b3711622e9eb5ccf8adef9566db6f62 (diff)
downloadzsh-59dbab4f1c0898f9a354d85051b1d5a5e776d984.tar.gz
zsh-59dbab4f1c0898f9a354d85051b1d5a5e776d984.tar.xz
zsh-59dbab4f1c0898f9a354d85051b1d5a5e776d984.zip
39792: improve handling of relative paths in _canonical_paths_add_paths
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Type/_canonical_paths5
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9dd63251e..2676d0a17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-10-31  Barton E. Schaefer  <schaefer@zsh.org>
+
+	* 39792: Completion/Unix/Type/_canonical_paths: improve handling
+	of relative paths in _canonical_paths_add_paths
+
 2016-10-31  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
 	* 39786: Functions/VCS_Info/Backends/VCS_INFO_get_data_hg,
diff --git a/Completion/Unix/Type/_canonical_paths b/Completion/Unix/Type/_canonical_paths
index 9bccc7f86..6482602ac 100644
--- a/Completion/Unix/Type/_canonical_paths
+++ b/Completion/Unix/Type/_canonical_paths
@@ -69,7 +69,10 @@ _canonical_paths_add_paths () {
   expref=${~origpref} 2>/dev/null
   [[ $origpref == (|*/). ]] && rltrim=.
   curpref=${${expref%$rltrim}:-./}
-  if zstat $curpref >&/dev/null; then
+  if [[ $expref:h == (.|..) ]]; then
+    _canonical_paths_pwd $expref:h
+    canpref=$REPLY/$expref:t
+  elif zstat $curpref >&/dev/null; then
     _canonical_paths_get_canonical_path $curpref
     canpref=$REPLY
   else