From 90c599e1a55ad750adc13f844694b2a3df96d090 Mon Sep 17 00:00:00 2001 From: Jun Jiang Date: Sat, 17 Dec 2016 04:51:04 +0800 Subject: [PATCH] avoid pushing duplicate keys --- lib/capistrano/configuration/variables.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/capistrano/configuration/variables.rb b/lib/capistrano/configuration/variables.rb index 424951d0..b42137f6 100644 --- a/lib/capistrano/configuration/variables.rb +++ b/lib/capistrano/configuration/variables.rb @@ -35,7 +35,7 @@ module Capistrano end def set(key, value=nil, &block) - @trusted_keys << key if trusted? + @trusted_keys << key if trusted? && !@trusted_keys.include?(key) remember_location(key) values[key] = block || value trace_set(key) @@ -43,7 +43,7 @@ module Capistrano end def fetch(key, default=nil, &block) - fetched_keys << key + fetched_keys << key unless fetched_keys.include?(key) peek(key, default, &block) end