From 9c85d737add16eb574740c637d498b8610dae0ca Mon Sep 17 00:00:00 2001
From: Mike McQuaid <mike@mikemcquaid.com>
Date: Sun, 14 May 2017 20:05:26 +0100
Subject: [PATCH] bin/brew: don't set blank HOMEBREW_* variables.

When creating the necessary HOMEBREW_* variables ensure that they aren't
set if their value would be empty.
---
 bin/brew | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/bin/brew b/bin/brew
index 20cf9564db..90e0cf3e99 100755
--- a/bin/brew
+++ b/bin/brew
@@ -49,7 +49,11 @@ HOMEBREW_LIBRARY="$HOMEBREW_REPOSITORY/Library"
 for VAR in AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY BINTRAY_USER BINTRAY_KEY \
            BROWSER EDITOR GIT PATH VISUAL
 do
+  # Skip if variable value is empty.
+  [[ -z "${!VAR}" ]] && continue
+
   VAR_NEW="HOMEBREW_${VAR}"
+  # Skip if existing HOMEBREW_* variable is set.
   [[ -n "${!VAR_NEW}" ]] && continue
   export "$VAR_NEW"="${!VAR}"
 done
-- 
GitLab