From 0bb85014e6bb4415ec19dd13ef7ae361a9f1e5b9 Mon Sep 17 00:00:00 2001
From: Daniel Hahler <github@thequod.de>
Date: Sat, 16 Dec 2017 01:04:13 +0100
Subject: [PATCH] Optimize _autoenv_stack_entered_contains (#88)

Only make `$env_file` absolute once.
---
 autoenv.zsh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/autoenv.zsh b/autoenv.zsh
index 94ac677..a7aaeb4 100644
--- a/autoenv.zsh
+++ b/autoenv.zsh
@@ -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
-- 
2.51.0