Jack Neus | fc3b577 | 2019-07-03 11:18:42 -0600 | [diff] [blame] | 1 | // Copyright 2019 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | package git |
| 5 | |
| 6 | import ( |
| 7 | "bytes" |
| 8 | "context" |
| 9 | "fmt" |
Jack Neus | 0296c73 | 2019-07-17 09:35:01 -0600 | [diff] [blame] | 10 | "path/filepath" |
Jack Neus | fc3b577 | 2019-07-03 11:18:42 -0600 | [diff] [blame] | 11 | "regexp" |
| 12 | "strings" |
Jack Neus | 0751172 | 2019-07-12 15:41:10 -0600 | [diff] [blame] | 13 | |
| 14 | "go.chromium.org/chromiumos/infra/go/internal/cmd" |
Jack Neus | 1f489f6 | 2019-08-06 12:01:54 -0600 | [diff] [blame] | 15 | "go.chromium.org/luci/common/errors" |
Jack Neus | fc3b577 | 2019-07-03 11:18:42 -0600 | [diff] [blame] | 16 | ) |
| 17 | |
| 18 | var ( |
Jack Neus | 0751172 | 2019-07-12 15:41:10 -0600 | [diff] [blame] | 19 | CommandRunnerImpl cmd.CommandRunner = cmd.RealCommandRunner{} |
Jack Neus | fc3b577 | 2019-07-03 11:18:42 -0600 | [diff] [blame] | 20 | ) |
| 21 | |
Jack Neus | fc3b577 | 2019-07-03 11:18:42 -0600 | [diff] [blame] | 22 | type CommandOutput struct { |
| 23 | Stdout string |
| 24 | Stderr string |
| 25 | } |
| 26 | |
| 27 | // Struct representing a remote ref. |
| 28 | type RemoteRef struct { |
| 29 | Remote string |
| 30 | Ref string |
| 31 | } |
| 32 | |
Jack Neus | ab8df5b | 2019-08-16 13:43:12 -0600 | [diff] [blame^] | 33 | type GitOpts struct { |
| 34 | DryRun bool |
| 35 | Force bool |
| 36 | } |
| 37 | |
Jack Neus | fc3b577 | 2019-07-03 11:18:42 -0600 | [diff] [blame] | 38 | // RunGit the specified git command in the specified repo. It returns |
| 39 | // stdout and stderr. |
| 40 | func RunGit(gitRepo string, cmd []string) (CommandOutput, error) { |
| 41 | ctx := context.Background() |
| 42 | var stdoutBuf, stderrBuf bytes.Buffer |
Jack Neus | 0751172 | 2019-07-12 15:41:10 -0600 | [diff] [blame] | 43 | err := CommandRunnerImpl.RunCommand(ctx, &stdoutBuf, &stderrBuf, gitRepo, "git", cmd...) |
Jack Neus | fc3b577 | 2019-07-03 11:18:42 -0600 | [diff] [blame] | 44 | cmdOutput := CommandOutput{stdoutBuf.String(), stderrBuf.String()} |
Jack Neus | 758a70f | 2019-08-20 10:32:12 -0600 | [diff] [blame] | 45 | return cmdOutput, errors.Annotate(err, cmdOutput.Stderr).Err() |
Jack Neus | fc3b577 | 2019-07-03 11:18:42 -0600 | [diff] [blame] | 46 | } |
| 47 | |
Jack Neus | 2bcf4a6 | 2019-07-25 10:35:05 -0600 | [diff] [blame] | 48 | // RunGitIgnore the specified git command in the specified repo and returns |
| 49 | // only an error, not the command output. |
| 50 | func RunGitIgnoreOutput(gitRepo string, cmd []string) error { |
| 51 | _, err := RunGit(gitRepo, cmd) |
| 52 | return err |
| 53 | } |
| 54 | |
Jack Neus | fc3b577 | 2019-07-03 11:18:42 -0600 | [diff] [blame] | 55 | // GetCurrentBranch returns current branch of a repo, and an empty string |
| 56 | // if repo is on detached HEAD. |
| 57 | func GetCurrentBranch(cwd string) string { |
| 58 | output, err := RunGit(cwd, []string{"symbolic-ref", "-q", "HEAD"}) |
| 59 | if err != nil { |
| 60 | return "" |
| 61 | } |
| 62 | return StripRefsHead(strings.TrimSpace(output.Stdout)) |
| 63 | } |
| 64 | |
| 65 | // MatchBranchName returns the names of branches who match the specified |
| 66 | // regular expression. |
| 67 | func MatchBranchName(gitRepo string, pattern *regexp.Regexp) ([]string, error) { |
Jack Neus | 10e6a12 | 2019-07-18 10:17:44 -0600 | [diff] [blame] | 68 | // MatchBranchWithNamespace trims the namespace off the branches it returns. |
| 69 | // Here, we need a namespace that matches every string but doesn't match any character |
| 70 | // (so that nothing is trimmed). |
| 71 | nullNamespace := regexp.MustCompile("") |
| 72 | return MatchBranchNameWithNamespace(gitRepo, pattern, nullNamespace) |
| 73 | } |
| 74 | |
| 75 | // MatchBranchNameWithNamespace returns the names of branches who match the specified |
| 76 | // pattern and start with the specified namespace. |
| 77 | func MatchBranchNameWithNamespace(gitRepo string, pattern, namespace *regexp.Regexp) ([]string, error) { |
Jack Neus | fc3b577 | 2019-07-03 11:18:42 -0600 | [diff] [blame] | 78 | // Regex should be case insensitive. |
Jack Neus | 10e6a12 | 2019-07-18 10:17:44 -0600 | [diff] [blame] | 79 | namespace = regexp.MustCompile("(?i)^" + namespace.String()) |
| 80 | pattern = regexp.MustCompile("(?i)" + pattern.String()) |
Jack Neus | fc3b577 | 2019-07-03 11:18:42 -0600 | [diff] [blame] | 81 | |
Jack Neus | 901a6bf | 2019-07-22 08:30:07 -0600 | [diff] [blame] | 82 | output, err := RunGit(gitRepo, []string{"show-ref"}) |
Jack Neus | fc3b577 | 2019-07-03 11:18:42 -0600 | [diff] [blame] | 83 | if err != nil { |
Jack Neus | 901a6bf | 2019-07-22 08:30:07 -0600 | [diff] [blame] | 84 | if strings.Contains(err.Error(), "exit status 1") { |
| 85 | // Not a fatal error, just no branches. |
| 86 | return []string{}, nil |
| 87 | } |
Jack Neus | fc3b577 | 2019-07-03 11:18:42 -0600 | [diff] [blame] | 88 | // Could not read branches. |
Jack Neus | 901a6bf | 2019-07-22 08:30:07 -0600 | [diff] [blame] | 89 | return []string{}, fmt.Errorf("git error: %s\nstdout: %s stderr: %s", err.Error(), output.Stdout, output.Stderr) |
Jack Neus | fc3b577 | 2019-07-03 11:18:42 -0600 | [diff] [blame] | 90 | } |
| 91 | // Find all branches that match the pattern. |
| 92 | branches := strings.Split(output.Stdout, "\n") |
| 93 | matchedBranches := []string{} |
| 94 | for _, branch := range branches { |
| 95 | branch = strings.TrimSpace(branch) |
| 96 | if branch == "" { |
| 97 | continue |
| 98 | } |
| 99 | branch = strings.Fields(branch)[1] |
Jack Neus | 10e6a12 | 2019-07-18 10:17:44 -0600 | [diff] [blame] | 100 | |
| 101 | // Only look at branches which match the namespace. |
| 102 | if !namespace.Match([]byte(branch)) { |
| 103 | continue |
| 104 | } |
| 105 | branch = namespace.ReplaceAllString(branch, "") |
| 106 | |
Jack Neus | fc3b577 | 2019-07-03 11:18:42 -0600 | [diff] [blame] | 107 | if pattern.Match([]byte(branch)) { |
| 108 | matchedBranches = append(matchedBranches, branch) |
| 109 | } |
| 110 | } |
| 111 | return matchedBranches, nil |
| 112 | } |
| 113 | |
Jack Neus | e237037 | 2019-08-14 17:25:16 -0600 | [diff] [blame] | 114 | // IsSHA checks whether or not the given ref is a SHA. |
| 115 | func IsSHA(ref string) bool { |
| 116 | shaRegexp := regexp.MustCompile("^[0-9a-f]{40}$") |
| 117 | return shaRegexp.MatchString(ref) |
| 118 | } |
| 119 | |
Jack Neus | fc3b577 | 2019-07-03 11:18:42 -0600 | [diff] [blame] | 120 | // GetGitRepoRevision finds and returns the revision of a branch. |
Jack Neus | a728752 | 2019-07-23 16:36:18 -0600 | [diff] [blame] | 121 | func GetGitRepoRevision(cwd, branch string) (string, error) { |
| 122 | if branch == "" { |
| 123 | branch = "HEAD" |
Jack Neus | 1f489f6 | 2019-08-06 12:01:54 -0600 | [diff] [blame] | 124 | } else if branch != "HEAD" { |
Jack Neus | 8b77083 | 2019-08-01 15:33:04 -0600 | [diff] [blame] | 125 | branch = NormalizeRef(branch) |
Jack Neus | a728752 | 2019-07-23 16:36:18 -0600 | [diff] [blame] | 126 | } |
| 127 | output, err := RunGit(cwd, []string{"rev-parse", branch}) |
Jack Neus | 1f489f6 | 2019-08-06 12:01:54 -0600 | [diff] [blame] | 128 | return strings.TrimSpace(output.Stdout), errors.Annotate(err, output.Stderr).Err() |
Jack Neus | fc3b577 | 2019-07-03 11:18:42 -0600 | [diff] [blame] | 129 | } |
| 130 | |
Jack Neus | a728752 | 2019-07-23 16:36:18 -0600 | [diff] [blame] | 131 | // IsReachable determines whether one commit ref is reachable from another. |
| 132 | func IsReachable(cwd, to_ref, from_ref string) (bool, error) { |
| 133 | _, err := RunGit(cwd, []string{"merge-base", "--is-ancestor", to_ref, from_ref}) |
| 134 | if err != nil { |
| 135 | if strings.Contains(err.Error(), "exit status 1") { |
| 136 | return false, nil |
| 137 | } |
| 138 | return false, err |
| 139 | } |
| 140 | return true, nil |
| 141 | } |
| 142 | |
Jack Neus | 7440c76 | 2019-07-22 10:45:18 -0600 | [diff] [blame] | 143 | // StripRefsHead removes leading 'refs/heads/' from a ref name. |
Jack Neus | fc3b577 | 2019-07-03 11:18:42 -0600 | [diff] [blame] | 144 | func StripRefsHead(ref string) string { |
| 145 | return strings.TrimPrefix(ref, "refs/heads/") |
| 146 | } |
| 147 | |
| 148 | // NormalizeRef converts git branch refs into fully qualified form. |
| 149 | func NormalizeRef(ref string) string { |
| 150 | if ref == "" || strings.HasPrefix(ref, "refs/") { |
| 151 | return ref |
| 152 | } |
| 153 | return fmt.Sprintf("refs/heads/%s", ref) |
| 154 | } |
| 155 | |
| 156 | // StripRefs removes leading 'refs/heads/', 'refs/remotes/[^/]+/' from a ref name. |
| 157 | func StripRefs(ref string) string { |
| 158 | ref = StripRefsHead(ref) |
| 159 | // If the ref starts with ref/remotes/, then we want the part of the string |
| 160 | // that comes after the third "/". |
| 161 | // Example: refs/remotes/origin/master --> master |
| 162 | // Example: refs/remotse/origin/foo/bar --> foo/bar |
| 163 | if strings.HasPrefix(ref, "refs/remotes/") { |
| 164 | refParts := strings.SplitN(ref, "/", 4) |
| 165 | return refParts[len(refParts)-1] |
| 166 | } |
| 167 | return ref |
| 168 | } |
Jack Neus | abdbe19 | 2019-07-15 12:23:22 -0600 | [diff] [blame] | 169 | |
| 170 | // CreateBranch creates a branch. |
| 171 | func CreateBranch(gitRepo, branch string) error { |
Jack Neus | 0296c73 | 2019-07-17 09:35:01 -0600 | [diff] [blame] | 172 | output, err := RunGit(gitRepo, []string{"checkout", "-B", branch}) |
Jack Neus | 10e6a12 | 2019-07-18 10:17:44 -0600 | [diff] [blame] | 173 | if err != nil { |
| 174 | if strings.Contains(output.Stderr, "not a valid branch name") { |
| 175 | return fmt.Errorf("%s is not a valid branch name", branch) |
| 176 | } else { |
| 177 | return fmt.Errorf(output.Stderr) |
| 178 | } |
Jack Neus | 0296c73 | 2019-07-17 09:35:01 -0600 | [diff] [blame] | 179 | } |
| 180 | return err |
| 181 | } |
| 182 | |
| 183 | // CreateTrackingBranch creates a tracking branch. |
| 184 | func CreateTrackingBranch(gitRepo, branch string, remoteRef RemoteRef) error { |
| 185 | refspec := fmt.Sprintf("%s/%s", remoteRef.Remote, remoteRef.Ref) |
| 186 | output, err := RunGit(gitRepo, []string{"fetch", remoteRef.Remote, remoteRef.Ref}) |
| 187 | if err != nil { |
| 188 | return fmt.Errorf("could not fetch %s: %s", refspec, output.Stderr) |
| 189 | } |
| 190 | output, err = RunGit(gitRepo, []string{"checkout", "-b", branch, "-t", refspec}) |
| 191 | if err != nil { |
| 192 | if strings.Contains(output.Stderr, "not a valid branch name") { |
| 193 | return fmt.Errorf("%s is not a valid branch name", branch) |
| 194 | } else { |
| 195 | return fmt.Errorf(output.Stderr) |
| 196 | } |
| 197 | } |
Jack Neus | abdbe19 | 2019-07-15 12:23:22 -0600 | [diff] [blame] | 198 | return err |
| 199 | } |
| 200 | |
| 201 | // CommitAll adds all local changes and commits them. |
Jack Neus | f116fae | 2019-07-24 15:05:03 -0600 | [diff] [blame] | 202 | // Returns the sha1 of the commit. |
| 203 | func CommitAll(gitRepo, commitMsg string) (string, error) { |
Jack Neus | 0296c73 | 2019-07-17 09:35:01 -0600 | [diff] [blame] | 204 | if output, err := RunGit(gitRepo, []string{"add", "-A"}); err != nil { |
Jack Neus | f116fae | 2019-07-24 15:05:03 -0600 | [diff] [blame] | 205 | return "", fmt.Errorf(output.Stderr) |
Jack Neus | abdbe19 | 2019-07-15 12:23:22 -0600 | [diff] [blame] | 206 | } |
Jack Neus | 0296c73 | 2019-07-17 09:35:01 -0600 | [diff] [blame] | 207 | if output, err := RunGit(gitRepo, []string{"commit", "-m", commitMsg}); err != nil { |
| 208 | if strings.Contains(output.Stdout, "nothing to commit") { |
Jack Neus | f116fae | 2019-07-24 15:05:03 -0600 | [diff] [blame] | 209 | return "", fmt.Errorf(output.Stdout) |
Jack Neus | 0296c73 | 2019-07-17 09:35:01 -0600 | [diff] [blame] | 210 | } else { |
Jack Neus | f116fae | 2019-07-24 15:05:03 -0600 | [diff] [blame] | 211 | return "", fmt.Errorf(output.Stderr) |
Jack Neus | 0296c73 | 2019-07-17 09:35:01 -0600 | [diff] [blame] | 212 | } |
Jack Neus | abdbe19 | 2019-07-15 12:23:22 -0600 | [diff] [blame] | 213 | } |
Jack Neus | f116fae | 2019-07-24 15:05:03 -0600 | [diff] [blame] | 214 | output, err := RunGit(gitRepo, []string{"rev-parse", "HEAD"}) |
| 215 | if err != nil { |
| 216 | return "", err |
| 217 | } |
| 218 | return strings.TrimSpace(output.Stdout), nil |
Jack Neus | abdbe19 | 2019-07-15 12:23:22 -0600 | [diff] [blame] | 219 | } |
| 220 | |
Jack Neus | 7440c76 | 2019-07-22 10:45:18 -0600 | [diff] [blame] | 221 | // CommitEmpty makes an empty commit (assuming nothing is staged). |
Jack Neus | f116fae | 2019-07-24 15:05:03 -0600 | [diff] [blame] | 222 | // Returns the sha1 of the commit. |
| 223 | func CommitEmpty(gitRepo, commitMsg string) (string, error) { |
Jack Neus | 7440c76 | 2019-07-22 10:45:18 -0600 | [diff] [blame] | 224 | if output, err := RunGit(gitRepo, []string{"commit", "-m", commitMsg, "--allow-empty"}); err != nil { |
Jack Neus | f116fae | 2019-07-24 15:05:03 -0600 | [diff] [blame] | 225 | return "", fmt.Errorf(output.Stderr) |
Jack Neus | 7440c76 | 2019-07-22 10:45:18 -0600 | [diff] [blame] | 226 | } |
Jack Neus | f116fae | 2019-07-24 15:05:03 -0600 | [diff] [blame] | 227 | output, err := RunGit(gitRepo, []string{"rev-parse", "HEAD"}) |
| 228 | if err != nil { |
Jack Neus | ab8df5b | 2019-08-16 13:43:12 -0600 | [diff] [blame^] | 229 | return "", err |
Jack Neus | f116fae | 2019-07-24 15:05:03 -0600 | [diff] [blame] | 230 | } |
| 231 | return strings.TrimSpace(output.Stdout), nil |
Jack Neus | 7440c76 | 2019-07-22 10:45:18 -0600 | [diff] [blame] | 232 | } |
| 233 | |
Jack Neus | eb25f72 | 2019-07-19 16:33:20 -0600 | [diff] [blame] | 234 | // PushRef pushes the specified local ref to the specified remote ref. |
Jack Neus | ab8df5b | 2019-08-16 13:43:12 -0600 | [diff] [blame^] | 235 | func PushRef(gitRepo, localRef string, pushTo RemoteRef, opts GitOpts) error { |
Jack Neus | abdbe19 | 2019-07-15 12:23:22 -0600 | [diff] [blame] | 236 | ref := fmt.Sprintf("%s:%s", localRef, pushTo.Ref) |
| 237 | cmd := []string{"push", pushTo.Remote, ref} |
Jack Neus | ab8df5b | 2019-08-16 13:43:12 -0600 | [diff] [blame^] | 238 | if opts.DryRun { |
Jack Neus | abdbe19 | 2019-07-15 12:23:22 -0600 | [diff] [blame] | 239 | cmd = append(cmd, "--dry-run") |
| 240 | } |
Jack Neus | ab8df5b | 2019-08-16 13:43:12 -0600 | [diff] [blame^] | 241 | if opts.Force { |
| 242 | cmd = append(cmd, "--force") |
| 243 | } |
Jack Neus | 7440c76 | 2019-07-22 10:45:18 -0600 | [diff] [blame] | 244 | _, err := RunGit(gitRepo, cmd) |
Jack Neus | 0296c73 | 2019-07-17 09:35:01 -0600 | [diff] [blame] | 245 | return err |
| 246 | } |
| 247 | |
| 248 | // Init initializes a repo. |
| 249 | func Init(gitRepo string, bare bool) error { |
| 250 | cmd := []string{"init"} |
| 251 | if bare { |
| 252 | cmd = append(cmd, "--bare") |
| 253 | } |
Jack Neus | abdbe19 | 2019-07-15 12:23:22 -0600 | [diff] [blame] | 254 | _, err := RunGit(gitRepo, cmd) |
| 255 | return err |
| 256 | } |
Jack Neus | 0296c73 | 2019-07-17 09:35:01 -0600 | [diff] [blame] | 257 | |
| 258 | // AddRemote adds a remote. |
| 259 | func AddRemote(gitRepo, remote, remoteLocation string) error { |
| 260 | output, err := RunGit(gitRepo, []string{"remote", "add", remote, remoteLocation}) |
| 261 | if err != nil { |
Jack Neus | eb25f72 | 2019-07-19 16:33:20 -0600 | [diff] [blame] | 262 | if strings.Contains(output.Stderr, "already exists") { |
| 263 | return fmt.Errorf("remote already exists") |
| 264 | } |
Jack Neus | 0296c73 | 2019-07-17 09:35:01 -0600 | [diff] [blame] | 265 | } |
| 266 | return err |
| 267 | } |
| 268 | |
| 269 | // Checkout checkouts a branch. |
| 270 | func Checkout(gitRepo, branch string) error { |
| 271 | output, err := RunGit(gitRepo, []string{"checkout", branch}) |
Jack Neus | 91de240 | 2019-08-14 08:26:03 -0600 | [diff] [blame] | 272 | if err != nil { |
Jack Neus | 0296c73 | 2019-07-17 09:35:01 -0600 | [diff] [blame] | 273 | return fmt.Errorf(output.Stderr) |
| 274 | } |
| 275 | return err |
| 276 | } |
| 277 | |
| 278 | // DeleteBranch checks out to master and then deletes the current branch. |
| 279 | func DeleteBranch(gitRepo, branch string, force bool) error { |
| 280 | cmd := []string{"branch"} |
| 281 | if force { |
| 282 | cmd = append(cmd, "-D") |
| 283 | } else { |
| 284 | cmd = append(cmd, "-d") |
| 285 | } |
| 286 | cmd = append(cmd, branch) |
| 287 | output, err := RunGit(gitRepo, cmd) |
| 288 | |
| 289 | if err != nil { |
| 290 | if strings.Contains(output.Stderr, "checked out at") { |
| 291 | return fmt.Errorf(output.Stderr) |
| 292 | } |
| 293 | if strings.Contains(output.Stderr, "not fully merged") { |
| 294 | return fmt.Errorf("branch %s is not fully merged. use the force parameter if you wish to proceed", branch) |
| 295 | } |
| 296 | } |
| 297 | return err |
| 298 | } |
| 299 | |
| 300 | // Clone clones the remote into the specified dir. |
| 301 | func Clone(remote, dir string) error { |
| 302 | output, err := RunGit(filepath.Dir(dir), []string{"clone", remote, filepath.Base(dir)}) |
| 303 | if err != nil { |
| 304 | return fmt.Errorf(output.Stderr) |
| 305 | } |
| 306 | return nil |
| 307 | } |
Jack Neus | 1f489f6 | 2019-08-06 12:01:54 -0600 | [diff] [blame] | 308 | |
| 309 | // RemoteBranches returns a list of branches on the specified remote. |
| 310 | func RemoteBranches(gitRepo, remote string) ([]string, error) { |
| 311 | output, err := RunGit(gitRepo, []string{"ls-remote", remote}) |
| 312 | if err != nil { |
| 313 | if strings.Contains(output.Stderr, "not appear to be a git repository") { |
| 314 | return []string{}, fmt.Errorf("%s is not a valid remote", remote) |
| 315 | } |
Jack Neus | e237037 | 2019-08-14 17:25:16 -0600 | [diff] [blame] | 316 | return []string{}, fmt.Errorf(output.Stderr) |
Jack Neus | 1f489f6 | 2019-08-06 12:01:54 -0600 | [diff] [blame] | 317 | } |
| 318 | remotes := []string{} |
| 319 | for _, line := range strings.Split(strings.TrimSpace(output.Stdout), "\n") { |
| 320 | if line == "" { |
| 321 | continue |
| 322 | } |
| 323 | remotes = append(remotes, StripRefs(strings.Fields(line)[1])) |
| 324 | } |
| 325 | return remotes, nil |
| 326 | } |
| 327 | |
| 328 | // RemoteHasBranch checks whether or not a branch exists on a remote. |
| 329 | func RemoteHasBranch(gitRepo, remote, branch string) (bool, error) { |
Jack Neus | e237037 | 2019-08-14 17:25:16 -0600 | [diff] [blame] | 330 | output, err := RunGit(gitRepo, []string{"ls-remote", remote, branch}) |
Jack Neus | 1f489f6 | 2019-08-06 12:01:54 -0600 | [diff] [blame] | 331 | if err != nil { |
Jack Neus | e237037 | 2019-08-14 17:25:16 -0600 | [diff] [blame] | 332 | if strings.Contains(output.Stderr, "not appear to be a git repository") { |
| 333 | return false, fmt.Errorf("%s is not a valid remote", remote) |
Jack Neus | 1f489f6 | 2019-08-06 12:01:54 -0600 | [diff] [blame] | 334 | } |
Jack Neus | e237037 | 2019-08-14 17:25:16 -0600 | [diff] [blame] | 335 | return false, fmt.Errorf(output.Stderr) |
Jack Neus | 1f489f6 | 2019-08-06 12:01:54 -0600 | [diff] [blame] | 336 | } |
Jack Neus | e237037 | 2019-08-14 17:25:16 -0600 | [diff] [blame] | 337 | return output.Stdout != "", nil |
Jack Neus | 1f489f6 | 2019-08-06 12:01:54 -0600 | [diff] [blame] | 338 | } |