-
Notifications
You must be signed in to change notification settings - Fork 245
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
Let shallow clone work with any ref #266
Conversation
Currently the shallow clone only works if ref is either not set, or set to the default branch. This is becuase go-getter does not set the ref to checkout during a shallow clone so Git assumes the default branch, and then when go-getter tries to checkout a ref other than the default branch it fails because the shallow clone did not fetch that ref. To fix this, I have used `--branch` to explicitly set the ref to fetch during a clone so that when a shallow clone is done go-getter will clone the ref given and not the default branch. This will also make clones of non-default branches just a tad bit more optimized since the clone will not waste time checking out a branch it ultimately will not use.
I was not able to get the tests to run locally and I couldn't seem to find any documentation to explain this. Also, I'm not sure if I was supposed to open a PR here or in terraform. Please advise :) |
Hello? |
I see that a similar PR was opened 9 months ago to address the same thing #251 Is this repo abandoned? |
Hello? |
@schmichael or @apparentlymart can we have your helm on this PR? |
@azr Any chance you could take a few minutes to look at this? It would be really great if we could close this issue which has been ongoing for more than a year. Thanks! |
Sorry for the delay everyone and thanks for the contribution. Unfortunately you'll still have to wait for dependent projects (Nomad, Terraform, etc) to update their go-getter dependency. |
On the face of it, the fix for this has changed the behaviour with regard to the "ref" parameter when getting from git. Previously it allowed any ref, so commit hash etc. Now it only allows branch names or tag names. My guess is that this is an unintended side effect of the change? |
Currently the shallow clone only works if ref is either not set, or set
to the default branch. This is becuase go-getter does not set the ref
to checkout during a shallow clone so Git assumes the default branch,
and then when go-getter tries to checkout a ref other than the default
branch it fails because the shallow clone did not fetch that ref.
To fix this, I have used
--branch
to explicitly set the ref to fetchduring a clone so that when a shallow clone is done go-getter will clone
the ref given and not the default branch. This will also make clones of
non-default branches just a tad bit more optimized since the clone will
not waste time checking out a branch it ultimately will not use.
Fixes hashicorp/terraform#10703