Skip to content

Commit

Permalink
fix after review
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolas Burkoff committed Nov 10, 2021
1 parent f8a41c0 commit 17a74b6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions R/git_tools.R
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,19 @@ install_external_deps <- function(repo_dir, internal_pkg_deps, ...) {
get_remote_name <- function(git_repo, repo_url) {

# remove the https:// and .git from repo_url
repo_url <- strsplit(repo_url, "//", fixed = TRUE)[[1]][2]
repo_url <- gsub(".git", "", repo_url)
repo_url <- gsub("^.+://", "", repo_url, perl = TRUE)
repo_url <- gsub(".git$", "", repo_url)


remotes <- git2r::remotes(git_repo)

for (remote in remotes) {

target_url <- git2r::remote_url(git_repo, remote = remote)
target_url <- gsub("^(https://|git@ssh.|git@)|\\.git$", "", target_url)
target_url <- gsub(":", "/", target_url, fixed = TRUE)

if (grepl(repo_url, target_url)) {
if (repo_url == target_url) {
return(remote)
}
}
Expand Down

0 comments on commit 17a74b6

Please sign in to comment.