diff --git a/utils/set_test_modules b/utils/set_test_modules
index 6f73ef870c44c5d93098e2f843e998fa8dc24fca..9f94d2c725ebff31d35ef7e1c683a01dcbace292 100644
--- a/utils/set_test_modules
+++ b/utils/set_test_modules
@@ -18,13 +18,11 @@ pushd "${TOPDIR}" >/dev/null 2>&1 || die "Failed to change directory."
 
 files_list=$(mktemp)
 
-if [ -z "$BASE_BRANCH" ]
-then
-    git remote add  _temp https://github.com/freeipa/ansible-freeipa
-    git fetch --prune --no-tags --quiet _temp
-    BASE_BRANCH="master"
-fi
-git diff "${BASE_BRANCH}" --name-only > "${files_list}"
+remote="$(basename $(mktemp -u remote_XXXXXX))"
+git remote add ${remote} https://github.com/freeipa/ansible-freeipa
+git fetch --prune --no-tags --quiet ${remote}
+git diff "${remote}/master" --name-only > "${files_list}"
+git remote remove ${remote}
 
 # Get all modules that should have tests executed
 enabled_modules="$(python utils/get_test_modules.py $(cat "${files_list}"))"