Compare commits

...

2 Commits

Author SHA1 Message Date
Félix Baylac Jacqué fe7c50f5a1 Release: 0.4 2023-01-15 12:03:53 +01:00
Félix Baylac Jacqué ff7ca8d534 bugfix: do not clone twice a git repository
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.
2023-01-15 11:50:51 +01:00
2 changed files with 11 additions and 7 deletions

View File

@ -1,9 +1,9 @@
;;; my-repo-pins-tests.el --- Project navigation and remote checkout -*- lexical-binding: t; -*-
;;; Copyright (C) 2022 Félix Baylac Jacqué
;;; Copyright (C) 2022-2023 Félix Baylac Jacqué
;;; Author: Félix Baylac Jacqué <felix at alternativebit.fr>
;;; Maintainer: Félix Baylac Jacqué <felix at alternativebit.fr>
;;; Version: 1.14.0
;;; Version: 0.4
;;; Packages-Requires: ((ert-async "0.1.2"))
;;; License:

View File

@ -1,9 +1,9 @@
;;; my-repo-pins.el --- Keep your git repositories organized -*- lexical-binding: t -*-
;;; Copyright (C) 2022 Félix Baylac Jacqué
;;; Copyright (C) 2022-2023 Félix Baylac Jacqué
;;; Author: Félix Baylac Jacqué <felix at alternativebit.fr>
;;; Maintainer: Félix Baylac Jacqué <felix at alternativebit.fr>
;;; Version: 0.2
;;; Version: 0.4
;;; Homepage: https://alternativebit.fr/projects/my-repo-pins/
;;; Package-Requires: ((emacs "26.1"))
;;; License:
@ -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)