From df1b7adc7e5db27120f24a50281c861c69d51902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Baylac=20Jacqu=C3=A9?= Date: Tue, 15 Nov 2022 18:11:48 +0100 Subject: [PATCH] [bugfix] Support more clone full URLs Supporting the git/ssh scheme for fully qualified URLs. Quoting https://git-scm.com/docs/git-clone#_git_urls: > The following syntaxes may be used with them: > ssh://[user@]host.xz[:port]/path/to/repo.git/ > git://host.xz[:port]/path/to/repo.git/ > http[s]://host.xz[:port]/path/to/repo.git/ > ftp[s]://host.xz[:port]/path/to/repo.git/ > > An alternative scp-like syntax may also be used with the ssh protocol: > [user@]host.xz:path/to/repo.git/ --- my-repo-pins-tests.el | 21 +++++++++++++++++++++ my-repo-pins.el | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/my-repo-pins-tests.el b/my-repo-pins-tests.el index 231d41c..ff6524a 100644 --- a/my-repo-pins-tests.el +++ b/my-repo-pins-tests.el @@ -377,6 +377,27 @@ it'll get deleted before the end of the test." (should (equal (my-repo-pins--parse-repo-identifier "https://github.com/Ninjatrappeur/my-repo-pins.el") '((tag . full-url) (full-url . "https://github.com/Ninjatrappeur/my-repo-pins.el")))) + (should (equal + (my-repo-pins--parse-repo-identifier "git@github.com:NinjaTrappeur/my-repo-pins.git") + '((tag . full-url) (full-url . "git@github.com:NinjaTrappeur/my-repo-pins.git")))) + (should (equal + (my-repo-pins--parse-repo-identifier "git://sourceware.org/git/elfutils.git") + '((tag . full-url) (full-url . "git://sourceware.org/git/elfutils.git")))) + (should (equal + (my-repo-pins--parse-repo-identifier "ssh://sourceware.org/git/elfutils.git") + '((tag . full-url) (full-url . "ssh://sourceware.org/git/elfutils.git")))) + (should (equal + (my-repo-pins--parse-repo-identifier "ftp://sourceware.org/git/elfutils.git") + '((tag . full-url) (full-url . "ftp://sourceware.org/git/elfutils.git")))) + (should (equal + (my-repo-pins--parse-repo-identifier "ftps://sourceware.org/git/elfutils.git") + '((tag . full-url) (full-url . "ftps://sourceware.org/git/elfutils.git")))) + (should (equal + (my-repo-pins--parse-repo-identifier "user@sourceware.org/git/elfutils.git") + '((tag . full-url) (full-url . "user@sourceware.org/git/elfutils.git")))) + (should (equal + (my-repo-pins--parse-repo-identifier "sourceware.org/git/elfutils.git") + '((tag . full-url) (full-url . "sourceware.org/git/elfutils.git")))) (should (equal (my-repo-pins--parse-repo-identifier "github.com/Ninjatrappeur/my-repo-pins.el") '((tag . full-url) (full-url . "github.com/Ninjatrappeur/my-repo-pins.el")))) diff --git a/my-repo-pins.el b/my-repo-pins.el index ec077dd..e2e7092 100644 --- a/my-repo-pins.el +++ b/my-repo-pins.el @@ -399,7 +399,8 @@ or (cond ;; Full-url case ((or (string-match "^https?://.*/.*/.*$" query-str) - (string-match "^.*/.*/.*$" query-str)) + (string-match "^.*/.*/.*$" query-str) + (string-match "^.*@.*:?.*$" query-str)) `((tag . full-url) (full-url . ,query-str))) ;; owner/repo case ((string-match "^.*/.*$" query-str)