Skip to content

Commit

Permalink
Merge pull request #16 from NinjaTrappeur/nin/fix-clone-url-parsing
Browse files Browse the repository at this point in the history
[bugfix] Support more clone full URLs
  • Loading branch information
Ninjatrappeur committed Nov 15, 2022
2 parents 98500dd + df1b7ad commit e6d7d6c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
21 changes: 21 additions & 0 deletions my-repo-pins-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -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 "[email protected]:NinjaTrappeur/my-repo-pins.git")
'((tag . full-url) (full-url . "[email protected]: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 "[email protected]/git/elfutils.git")
'((tag . full-url) (full-url . "[email protected]/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"))))
Expand Down
3 changes: 2 additions & 1 deletion my-repo-pins.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e6d7d6c

Please sign in to comment.