Skip to content

Commit

Permalink
fix: Allow using '/' in git refs (#112)
Browse files Browse the repository at this point in the history
Co-authored-by: Zadkiel <hello@zadkiel.fr>
  • Loading branch information
jaroslaw-osmanski and aslafy-z committed Nov 11, 2020
1 parent bbad77f commit a211190
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions helm-git-plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,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 ]
}

0 comments on commit a211190

Please sign in to comment.