                     (re-matches #"^[a-fA-F0-9]{5,40}$"
                                 (string/trim x)))))]
     (let [branches (cond->> [build-branch]
-                     (and (not (empty? scm-branch)))
+                     (not (empty? scm-branch))
                      (cons scm-branch)
 
                      (and (not (empty? env-branch))

        (update-workspace local branch depth)
        (clone-workspace local remote reference branch depth))
      (when commit
        (checkout-commit local commit))))
  opts)

          commit (first (take-while commit? branches))
          branch (first (drop-while commit? branches))]
      {:commit commit :branch (or branch "master")})))

(defn clean-branch-name [branch]
  (-> branch
      (string/replace #"^refs/heads/" "")
      (string/replace #"^origin/" "")))

(defn checkout-dir [opts]
  (let [cwd (-> opts :process :cwd)]
