                     (git-commit "initial commit")
                     (git-checkout-b "some-branch")
 
-                    (start-wait-for-git-step-with-ref (fn [ref] true))
+                    (start-wait-for-git-step :ref (fn [ref] true))
                     (git-commit "some commit on master")
                     (wait-for-step-to-complete)
 
                     (git-checkout "some-branch")
-                    (start-wait-for-git-step-with-ref (fn [ref] true))
+                    (start-wait-for-git-step :ref (fn [ref] true))
                     (git-commit "some commit on branch")
 
                     (get-step-result))]

(defn- expected-timestamp [state commit-msg]
  (git-utils/commit-timestamp-date (:git @state) (commit-hash-by-msg state commit-msg)))

(deftest wait-for-git-test-clean
  (testing "that it waits for a new commit to happen and that it prints out information on old and new commit"
    (let [state (-> (init-state)
                    (git-init)
                    (git-commit "initial commit")
                    (start-wait-for-git-step-with-ref "refs/heads/master")
                    (wait-for-step-waiting)
                    (git-commit "other commit")
                    (get-step-result))]

              (recur)))))))
  state)

(defn start-wait-for-git-step [state & {:keys [ref ms-between-polls] :or {ms-between-polls 100
                                                                              ref          "refs/heads/master"}}]
  (let [wait-for-result-channel (async/go
                                  (let [execute-step-result (lambdacd-core/execute-step {} (:ctx @state)
                                                                                        (fn [args ctx]
                                                                                          (wait-for-git ctx (get-in @state [:git :remote]) :ref ref :ms-between-polls ms-between-polls)))]
                                    (first (vals (:outputs execute-step-result)))))]
    (swap! state #(assoc % :result-channel wait-for-result-channel))
    (wait-for-step-waiting state)
