terraform/internal/getmodules
Martin Atkins c4d46e7c6b getmodules: Re-allow git:: source with ref=COMMIT_ID
Earlier versions of this code allowed "ref" to take any value that would
be accepted by "git checkout" as a valid target of a symbolic ref. We
inadvertently accepted a breaking change to upstream go-getter that broke
that as part of introducing a shallow clone optimization, because shallow
clone requires selecting a single branch.

To restore the previous capabilities while retaining the "depth" argument,
here we accept a compromise where "ref" has the stronger requirement of
being a valid named ref in the remote repository if and only if "depth"
is set to a value greater than zero. If depth isn't set or is less than
one, we will do the old behavior of just cloning all of the refs in the
remote repository in full and then switching to refer to the selected
branch, tag, or naked commit ID as a separate step.

This includes a heuristic to generate an additional error message hint if
we get an error from "git clone" and it looks like the user might've been
trying to use "depth" and "ref=COMMIT" together. We can't recognize that
error accurately because it's only reported as human-oriented git command
output, but this heuristic should hopefully minimize situations where we
show it inappropriately.

For now this is a change in the Terraform repository directly, so that we
can expedite the fix to an already-reported regression. After this is
released I tend to also submit a similar set of changes to upstream
go-getter, at which point we can revert Terraform to using the upstream
getter.GitGetter instead of our own local fork.
2021-12-14 11:24:23 -08:00
..
doc.go getmodules: Beginnings of a new package about Terraform module packages 2021-06-03 08:50:34 -07:00
file_detector.go Refactoring of module source addresses and module installation 2021-06-03 08:50:34 -07:00
getter.go getmodules: Inline our own fork of getter.GitGetter 2021-12-14 11:24:23 -08:00
git_getter.go getmodules: Re-allow git:: source with ref=COMMIT_ID 2021-12-14 11:24:23 -08:00
git_getter_test.go getmodules: Re-allow git:: source with ref=COMMIT_ID 2021-12-14 11:24:23 -08:00
installer.go command: make module installation interruptible 2021-11-11 12:28:10 +00:00
package.go Refactoring of module source addresses and module installation 2021-06-03 08:50:34 -07:00
subdir.go getmodules: Beginnings of a new package about Terraform module packages 2021-06-03 08:50:34 -07:00