   [meta]
   (set (keys (:causal-order meta))))
 
-(defn- new-commits! [store metas]
+(defn- new-commits!
+  "Computes difference between local and remote repo"
+  [store metas]
   (go (->> (for [[user repos] metas
                  [repo meta] repos]
              (go {:new meta

        sessions (atom {})
        p-in (pub in in-dispatch)]
    (sub p-in :meta-pub pub-ch)
    (meta-published pub-ch store trusted-hosts sessions [new-in out])

    (sub p-in ::auth-required auth-req-ch)
    (auth-required auth-req-ch auth-fn out)

    (sub p-in ::auth auth-ch)
    (authenticated auth-ch pub-ch credential-fn)

    (sub p-in :unrelated new-in)

    [new-in out]))


(comment

;;     On your backend server, verify that the code is valid and exchange it for a long-lived token, which is stored in your database and sent back to be stored on the client device as well.
;;     The user is now logged in, and doesn’t have to repeat this process again until their token expires or they want to authenticate on a new device.

(defn- meta-published
  "Checks wether the user has a running session, the host is trusted und verifies credentials if the user ist not authenticated"
  [pub-ch store trusted-hosts sessions credential-fn [new-in out]]
  (go-loop [{:keys [metas topic] :as p} (<! pub-ch)]
    (when (= topic :meta-pub)
     (let [nc (<! (new-commits! store metas))]
