-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for GitLab subgroups #308
base: main
Are you sure you want to change the base?
Conversation
src <- paste0(src_root, "/repository/archive.tar.gz?ref=", utils::URLencode(x$ref, reserved = TRUE)) | ||
|
||
if (!quiet) { | ||
message("Downloading GitLab repo ", x$username, "/", x$repo, "@", x$ref, | ||
"\nfrom URL ", src) | ||
message("Downloading GitLab repo ", gsub("/$", "", x$username, "/", x$repo, "/", x$subdir), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you actually getting a trailing slash in the subdirectory or just being cautious? In general I would consider specs with a trailing slash to be invalid input, and actually it seems parse_git_repo()
strips them anyway, so you can remove the gsub here and below I think.
> parse_git_repo("foo/bar/baz/")
$username
[1] "foo"
$repo
[1] "bar"
$subdir
[1] "baz"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh now that I look at this again this handles the case when subdir is empty. I think a better approach is to use paste0(c(x$username, x$repo, x$subdir), collapse = "/")
I am also missing this functionality of installing packages from a path with three levels (not sure if it is a subgroup or subdirectory). Having tried out this branch I still run into problems. As far as I can see
The first two works for me, but the last one fails. With this change it works for me. |
IMHO we should avoid overloading the meaning of I think it would be better to augment the parser so that there's a way to parse sub-directories and sub-groups separately (either globally or just a GitLab-only parser). |
A quick and dirty prototype workaround to address issue #259.
As the
install_gitlab
seems to not support (yet) subdirectories, the workaround is based on thesubdir
variable. However in case a repo is inside a subgroup there is a mismatch –subdir
corresponds to a repository, andrepo
to a subgroup (result of the general parsing rules in parse_repo_spec). How about fixing that mismatch with a new dedicatedparse_repo_gitlab
function?