Merge pull request #16 from NinjaTrappeur/nin/fix-clone-url-parsing

[bugfix] Support more clone full URLs
This commit is contained in:
Ninjatrappeur 2022-11-15 18:29:32 +01:00 committed by GitHub
commit e6d7d6c21c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View File

@ -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"))))

View File

@ -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)