hashicorp / go-getter

Package for downloading things from a string URL using a variety of protocols.
Mozilla Public License 2.0
1.65k stars 232 forks source link

GitHub https downloads break when there is a / in the branch name. #422

Open lazzurs opened 1 year ago

lazzurs commented 1 year ago

The issue appears to be with the logic here on splitting the URL based on / here

https://github.com/hashicorp/go-getter/blob/0edab85348271c843782993345b07b1ac98912e6/detect_github.go#L25

When using this in Terragrunt the following works

source = "github.com/xxx/infrastructure-modules//dev-dns-zone?ref=v0.0.1"

But this does not

source = "github.com/xxx/infrastructure-modules//dev-dns-zone?ref=feat/PTP-1841"

The error in Terragrunt clearly shows the branch name is having the part after / chopped off.

ERRO[0001] 1 error occurred:
* error downloading 'https://github.com/xxx/infrastructure-modules.git?ref=feat': /opt/homebrew/bin/git exited with 1: error: pathspec 'feat' did not match any file(s) known to git

ERRO[0001] Unable to determine underlying exit code, so Terragrunt will exit with error code 1

Issue raised in Terragrunt for this is https://github.com/gruntwork-io/terragrunt/issues/2473

cwyl02 commented 1 year ago

Seeing this issue in our code base as well