Can use git update-ref for atomic compare+write branch updates
;; Git transactions with error reporting, pseudo-code
(let [tseq (read-tree* "git" "/Users/matvore/.hesocfg" tree-sha trans)]
(comment do transaction here)
(if @(:err trans) ; guarantees streams have been closed
(comment report error)
(comment commit changes)))
(defn read-tree* [git git-dir hash]
(let [stream (comment open stdout for cat-file process)]
(send trans open stream)
(comment perform transaction sub-operations here)
(send trans close stream)))
JSch
Apparently only implements SSH client functionality
Generate RSA key pair with JSch:
(def j (new com.jcraft.jsch.JSch))
(def kp (com.jcraft.jsch.KeyPair/genKeyPair j com.jcraft.jsch.KeyPair/RSA))
(.isEncrypted kp)
(.writePrivateKey kp "/tmp/key")
(.writePublicKey kp "/tmp/key.pub" "My public key")
Also looks decent, but apparently only client