about summary refs log tree commit diff
diff options
context:
space:
mode:
authorHan Pingtian <hanpt@linux.vnet.ibm.com>2015-05-27 14:22:13 +0800
committerPeter Stephenson <pws@zsh.org>2015-05-27 09:32:15 +0100
commit2d86de91c1bb215a12751525c0f02a04c05385ea (patch)
treed2d552895ad047f0de55fba3ab51b1ae324734d2
parent0a97508bf64f0a5311d67d2a53a9d05147947b8c (diff)
downloadzsh-2d86de91c1bb215a12751525c0f02a04c05385ea.tar.gz
zsh-2d86de91c1bb215a12751525c0f02a04c05385ea.tar.xz
zsh-2d86de91c1bb215a12751525c0f02a04c05385ea.zip
35299: Improve effect of zfdir -r
-rw-r--r--ChangeLog5
-rw-r--r--Functions/Zftp/zfdir7
2 files changed, 9 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c226c1e42..45f398448 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-27  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* Han Pingtian: 35299: Functions/Zftp/zfdir: improve effect of
+	zfdir -r.
+
 2015-05-26  Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
 
 	* 35289: Doc/Zsh/builtions.yo: fix typos in the description
diff --git a/Functions/Zftp/zfdir b/Functions/Zftp/zfdir
index 4818dc973..5ec0ebf8c 100644
--- a/Functions/Zftp/zfdir
+++ b/Functions/Zftp/zfdir
@@ -62,7 +62,7 @@ for (( i = 1; i <= $#argv; i++ )); do
   fi
 done
 
-if [[ $# -eq 0 ]]; then
+if [[ $# -eq 0 && $redir -ne 1 ]]; then
   # Cache it in the current directory file.  This means that repeated
   # calls to zfdir with no arguments always use a cached file.
   if [[ -z $curdir ]]; then
@@ -79,11 +79,12 @@ else
   fi
   file=$otherdir
   newargs="$*"
-  if [[ -f $file && $redir != 1 && $force -ne 1 ]]; then
+  if [[ -f $file && -n $newargs && $force -ne 1 ]]; then
     # Don't use the cached file if the arguments changed.
+    # Even in zfdir -r new_args ...
     [[ $newargs = $zfconfig[otherargs_$ZFTP_SESSION] ]] || rm -f $file
   fi
-  zfconfig[otherargs_$ZFTP_SESSION]=$newargs
+  [[ -n $newargs ]] && zfconfig[otherargs_$ZFTP_SESSION]=$newargs
 fi
 
 if [[ $force -eq 1 ]]; then