|
| 1 | +From aa98faf317f26cd461740fd79bf67abb9890fa07 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Mark Collao < [email protected]> |
| 3 | +Date: Fri, 12 Apr 2024 14:06:23 -0500 |
| 4 | +Subject: [PATCH] escape user provide string to git |
| 5 | + |
| 6 | +Modified to apply to vendored code by: Daniel McIlvaney < [email protected]> |
| 7 | + - Adjusted paths to work for vendored version |
| 8 | + - Removed test code since it is not included in vendor trace |
| 9 | +--- |
| 10 | + vendor/github.com/hashicorp/go-getter/get_git.go | 4 ++-- |
| 11 | + 1 file changed, 2 insertions(+), 2 deletions(-) |
| 12 | + |
| 13 | +diff --git a/vendor/github.com/hashicorp/go-getter/get_git.go b/vendor/github.com/hashicorp/go-getter/get_git.go |
| 14 | +index db89ede..5227db7 100644 |
| 15 | +--- a/vendor/github.com/hashicorp/go-getter/get_git.go |
| 16 | ++++ b/vendor/github.com/hashicorp/go-getter/get_git.go |
| 17 | +@@ -200,7 +200,7 @@ func (g *GitGetter) clone(ctx context.Context, dst, sshKeyFile string, u *url.UR |
| 18 | + args = append(args, "--depth", strconv.Itoa(depth)) |
| 19 | + args = append(args, "--branch", ref) |
| 20 | + } |
| 21 | +- args = append(args, u.String(), dst) |
| 22 | ++ args = append(args, "--", u.String(), dst) |
| 23 | + |
| 24 | + cmd := exec.CommandContext(ctx, "git", args...) |
| 25 | + setupGitEnv(cmd, sshKeyFile) |
| 26 | +@@ -289,7 +289,7 @@ func findDefaultBranch(ctx context.Context, dst string) string { |
| 27 | + // default branch. "master" is returned if no HEAD symref exists. |
| 28 | + func findRemoteDefaultBranch(ctx context.Context, u *url.URL) string { |
| 29 | + var stdoutbuf bytes.Buffer |
| 30 | +- cmd := exec.CommandContext(ctx, "git", "ls-remote", "--symref", u.String(), "HEAD") |
| 31 | ++ cmd := exec.CommandContext(ctx, "git", "ls-remote", "--symref", "--", u.String(), "HEAD") |
| 32 | + cmd.Stdout = &stdoutbuf |
| 33 | + err := cmd.Run() |
| 34 | + matches := lsRemoteSymRefRegexp.FindStringSubmatch(stdoutbuf.String()) |
| 35 | +-- |
| 36 | +2.33.8 |
0 commit comments