From 320cd7f3648b0e30bf48d0fff461d1f79090a589 Mon Sep 17 00:00:00 2001
From: James Lopez <james@jameslopez.es>
Date: Mon, 16 Jan 2017 13:37:04 +0100
Subject: [PATCH] fix var inside loop

---
 db/migrate/20161226122833_remove_dot_git_from_usernames.rb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/db/migrate/20161226122833_remove_dot_git_from_usernames.rb b/db/migrate/20161226122833_remove_dot_git_from_usernames.rb
index 4e59cbd8a7f..c3a8f2fd91c 100644
--- a/db/migrate/20161226122833_remove_dot_git_from_usernames.rb
+++ b/db/migrate/20161226122833_remove_dot_git_from_usernames.rb
@@ -68,8 +68,10 @@ class RemoveDotGitFromUsernames < ActiveRecord::Migration
   end
 
   def check_routes(base, counter, path)
+    route_exists = route_exists?(path)
+
     Gitlab.config.repositories.storages.each_value do |storage|
-      if route_exists?(path) || path_exists?(path, storage)
+      if route_exists && path_exists?(path, storage)
         counter += 1
         path = "#{base}#{counter}"
 
-- 
GitLab