h-clone-project: full url clone

When the user queries a full git URL, directly clone the said URL
instead of querying the upstream forges.
This commit is contained in:
Félix Baylac-Jacqué 2022-06-10 14:33:11 +02:00
parent d3b80e7a51
commit ab2431b750
No known key found for this signature in database
GPG key ID: EFD315F31848DBA4

13
h.el
View file

@ -556,14 +556,21 @@ TODO: split that mess before release. We shouldn't query here."
(h--update-forges-state ,forge-str new-state))))))))
relevant-forges))
((equal repo-query-kind 'repo) (error (format "Can't checkout %s (for now), please specify a owner" repo-query)))
((equal repo-query-kind 'full-url) (error "TODO: Can't checkout a full URL (for now)"))
(t (error repo-query-kind)))))
((equal repo-query-kind 'full-url)
(let*
((code-root (h--safe-get-code-root))
(dest-dir (concat code-root (h--filepath-from-clone-url repo-query))))
(progn
(h--git-clone-in-dir repo-query dest-dir)
(find-file dest-dir))))
(t (error repo-query-kind)))))
;;;;;;;;;;;;;;;;;;;;;;;;
;; Interactive Commands
;;;;;;;;;;;;;;;;;;;;;;;;
(defun h-checkout-project (user-query)
(defun h-clone-project (user-query)
"Clone USER-QUERY in its appropriate directory in h-code-root."
(interactive "sGit repository to checkout: ")
(progn
(setq h--forge-fetchers-state nil)