Skip to content

Commit

Permalink
bugfix: do not clone twice a git repository
Browse files Browse the repository at this point in the history
Trying to clone a repository already living in the code root was
leading to a bogus "xxx does not seem to be a valid git repository
URL" error.

We fix this by first resolving the repository path on the local disk
and check whether or not we already cloned it. If that's the case,
open the repository instead of trying to clone it.
  • Loading branch information
picnoir committed Jan 15, 2023
1 parent 765629e commit ff7ca8d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions my-repo-pins.el
Original file line number Diff line number Diff line change
Expand Up @@ -873,16 +873,20 @@ USER-QUERY was the original query for this state update."
If the project is not in the ‘my-repo-pins-code-root’ yet, check it out from the
available forge sources."
(interactive)
(let ((user-query
(let* ((user-query
(my-repo-pins--completing-read-or-custom
"Jump to project: "
(my-repo-pins--get-code-root-projects (my-repo-pins--safe-get-code-root) my-repo-pins-max-depth))))
(my-repo-pins--get-code-root-projects (my-repo-pins--safe-get-code-root) my-repo-pins-max-depth)))
(query-local-path (concat (my-repo-pins--safe-get-code-root)
(my-repo-pins--filepath-from-clone-url (cdr user-query)))))
(cond
((equal (car user-query) 'in-collection)
(let ((selected-project-absolute-path (concat (my-repo-pins--safe-get-code-root) (cdr user-query))))
(my-repo-pins--open selected-project-absolute-path)))
((equal (car user-query) 'user-provided)
(my-repo-pins--clone-project (cdr user-query))))))
(if (file-directory-p query-local-path)
(my-repo-pins--open query-local-path)
(my-repo-pins--clone-project (cdr user-query)))))))


(provide 'my-repo-pins)
Expand Down

0 comments on commit ff7ca8d

Please sign in to comment.