]> Sergey Matveev's repositories - zsh-autoenv.git/commitdiff
Optimize _autoenv_stack_entered_contains (#88)
authorDaniel Hahler <github@thequod.de>
Sat, 16 Dec 2017 00:04:13 +0000 (01:04 +0100)
committerGitHub <noreply@github.com>
Sat, 16 Dec 2017 00:04:13 +0000 (01:04 +0100)
Only make `$env_file` absolute once.

autoenv.zsh

index 94ac677722c15ecbb48e8478961763b3093e89f3..a7aaeb40de9e656ec954d80f2064b71a557b3d8a 100644 (file)
@@ -117,8 +117,9 @@ _autoenv_stack_entered_contains() {
     # Entry is in stack.
     f=$env_file
   else
+    local env_file_abs=${env_file:A}
     for i in $_autoenv_stack_entered; do
-      if [[ ${i:A} == ${env_file:A} ]]; then
+      if [[ ${i:A} == ${env_file_abs} ]]; then
         # Entry is in stack (compared with resolved symlinks).
         f=$i
         break