mirror of
https://github.com/NinjaTrappeur/my-repo-pins.git
synced 2024-06-26 13:33:45 +02:00
full url git clone: jump to local dir if project already checked out
When cloning a project from a fullly qualified URL, we make sure the project does not exists locally. If it does, we jump to the local clone without trying to clone it again. Fixes https://github.com/NinjaTrappeur/my-repo-pins/issues/9
This commit is contained in:
parent
6ba6054165
commit
14d803aaae
|
@ -721,7 +721,7 @@ USER-QUERY was the original query for this state update."
|
||||||
(defun my-repo-pins--query-forge-fetchers (repo-query)
|
(defun my-repo-pins--query-forge-fetchers (repo-query)
|
||||||
"Find repo matches to the relevant forges for REPO-QUERY then query forge.
|
"Find repo matches to the relevant forges for REPO-QUERY then query forge.
|
||||||
|
|
||||||
TODO: split that mess before release. We shouldn't query here."
|
TODO: split that mess before 1.0. We shouldn't query here."
|
||||||
(let* ((parsed-repo-query (my-repo-pins--parse-repo-identifier repo-query))
|
(let* ((parsed-repo-query (my-repo-pins--parse-repo-identifier repo-query))
|
||||||
(repo-query-kind (alist-get 'tag parsed-repo-query)))
|
(repo-query-kind (alist-get 'tag parsed-repo-query)))
|
||||||
(cond
|
(cond
|
||||||
|
@ -745,13 +745,15 @@ TODO: split that mess before release. We shouldn't query here."
|
||||||
(let*
|
(let*
|
||||||
((code-root (my-repo-pins--safe-get-code-root))
|
((code-root (my-repo-pins--safe-get-code-root))
|
||||||
(dest-dir (concat code-root (my-repo-pins--filepath-from-clone-url repo-query))))
|
(dest-dir (concat code-root (my-repo-pins--filepath-from-clone-url repo-query))))
|
||||||
|
(if (not (file-directory-p dest-dir))
|
||||||
(my-repo-pins--git-clone-in-dir
|
(my-repo-pins--git-clone-in-dir
|
||||||
repo-query
|
repo-query
|
||||||
dest-dir
|
dest-dir
|
||||||
(lambda (exit-code)
|
(lambda (exit-code)
|
||||||
(if (equal exit-code 0)
|
(if (equal exit-code 0)
|
||||||
(find-file dest-dir)
|
(find-file dest-dir)
|
||||||
(error "Cannot clone %s" repo-query))))))
|
(error "Cannot clone %s" repo-query))))
|
||||||
|
(find-file dest-dir))))
|
||||||
(t (error repo-query-kind)))))
|
(t (error repo-query-kind)))))
|
||||||
|
|
||||||
;;=====================
|
;;=====================
|
||||||
|
|
Loading…
Reference in a new issue