Skip to content

Commit

Permalink
linking to other git than github
Browse files Browse the repository at this point in the history
A proposition to link to other git plateforms than github, e.g. gitlab.com or any gitlab server, as asked in issue r-lib#1045
I did not change add_github_links accoringly as I do not see clearly how neither what it is for...
  • Loading branch information
floriandeboissieu authored Jan 15, 2020
1 parent 134033d commit 3897c85
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions R/github.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
github_url_rx <- function() {
paste0(
"^",
"(?:https?://github.com/)",
"(?:https?://)",
"(?<git>[^/]+)/",
"(?<owner>[^/]+)/",
"(?<repo>[^/#]+)",
"/?",
Expand All @@ -21,7 +22,7 @@ github_url_rx <- function() {
## output: "https://github.com/r-lib/gh"
pkg_github_url <- function(desc) {
urls <- desc$get_urls()
gh_links <- grep("^https?://github.com/", urls, value = TRUE)
gh_links <- grep("^https?://git", urls, value = TRUE)

if (length(gh_links) == 0) {
return()
Expand All @@ -33,7 +34,7 @@ pkg_github_url <- function(desc) {

parse_github_link <- function(link) {
x <- rematch2::re_match(link, github_url_rx())
paste0("https://github.com/", x$owner, "/", x$repo)
paste0("https://", x$git, "/", x$owner, "/", x$repo)
}

github_source <- function(base, paths) {
Expand Down

0 comments on commit 3897c85

Please sign in to comment.