Skip to content
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

fix: Allow using '/' in git refs #112

Merged
merged 2 commits into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions helm-git-plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ main() {

readonly git_repo=$(echo "$_raw_uri" | sed -E 's#^([^/]+//[^/]+[^@\?]+)@?[^@\?]+\??.*$#\1#')
# TODO: Validate git_repo
readonly git_path=$(echo "$_raw_uri" | sed -E 's#.*@(.*)\/.*#\1#')
readonly git_path=$(echo "$_raw_uri" | sed -E 's#.*@([^?]*)\/.*#\1#')
# TODO: Validate git_path
readonly helm_file=$(echo "$_raw_uri" | sed -E 's#.*@.*\/([^?]*).*#\1#')
readonly helm_file=$(echo "$_raw_uri" | sed -E 's#.*@[^?]*\/([^?]*).*#\1#')

git_ref=$(echo "$_raw_uri" | sed '/^.*ref=\([^&#]*\).*$/!d;s//\1/')
# TODO: Validate git_ref
Expand Down
5 changes: 5 additions & 0 deletions tests/04-uri-validation.bats
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@ load 'test-helper'
_run_helm_git "git+https://github.com/jetstack/cert-manager@deploy/charts/index.yaml?ref=master&sparse=1"
[ $status = 0 ]
}

@test "should success with forward slash in ref" {
_run_helm_git "git+https://github.com/jaroslaw-osmanski/helm-git-test@/index.yaml?ref=feature/feature-test"
[ $status = 0 ]
}