(defn read-git-origin
"Reads the URL for the remote origin repository."
[git-dir]
(with-open [rdr (reader (file git-dir "config"))]
(->> (map #(.trim %) (line-seq rdr))
(drop-while #(not= "[remote \"origin\"]" %))
(next)
(take-while #(not (.startsWith % "[")))
(map #(re-matches #"url\s*=\s*(\S*)\s*" %))
(filter identity)
(first)
(second))))
Comments top
No comments for read-git-origin. Log in to add a comment.