func deleteTag(ctx context.Context, workingDir, tag, upstream string) error {
	args := []string{"push", "--delete", upstream, "tag", tag}
	return execGitCmd(ctx, args, gitCmdConfig{dir: workingDir})
}
deleteTag deletes the given git tag
See https://git-scm.com/docs/git-tag and https://git-scm.com/docs/git-push for more info.
package git
import (
	"bufio"
	"bytes"
	"context"
	"crypto/rand"
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"os/exec"
	"strings"
	"sync"
	"github.com/pkg/errors"
)
const trace = false
var exemptedTraceCommands = []string{
}
var allowedEnvVars = []string{
	"http_proxy", "https_proxy", "no_proxy", "HTTPS_PROXY", "NO_PROXY", "GIT_PROXY_COMMAND",
	"HOME", "GNUPGHOME",
	"SECRETS_DIR", "SECRETS_EXTENSION",
	"CLOUDSDK_CONFIG", "CLOUDSDK_PYTHON",
	"NSS_WRAPPER_PASSWD", "NSS_WRAPPER_GROUP", "LD_PRELOAD",
	"AWS_WEB_IDENTITY_TOKEN_FILE", "AWS_ROLE_ARN",
}
type gitCmdConfig struct {
	dir string
	env []string
	out io.Writer
}
func config(ctx context.Context, workingDir, user, email string) error {
	for k, v := range map[string]string{
		"user.name":  user,
		"user.email": email,
	} {
		args := []string{"config", k, v}
		if err := execGitCmd(ctx, args, gitCmdConfig{dir: workingDir}); err != nil {
			return errors.Wrap(err, "setting git config")
		}
	}
	return nil
}
func clone(ctx context.Context, workingDir, repoURL, repoBranch string) (path string, err error) {
	repoPath := workingDir
	args := []string{"clone"}
	if repoBranch != "" {
		args = append(args, "--branch", repoBranch)
	}
	args = append(args, repoURL, repoPath)
	if err := execGitCmd(ctx, args, gitCmdConfig{dir: workingDir}); err != nil {
		return "", errors.Wrap(err, "git clone")
	}
	return repoPath, nil
}
func mirror(ctx context.Context, workingDir, repoURL string) (path string, err error) {
	repoPath := workingDir
	args := []string{"clone", "--mirror"}
	args = append(args, repoURL, repoPath)
	if err := execGitCmd(ctx, args, gitCmdConfig{dir: workingDir}); err != nil {
		return "", errors.Wrap(err, "git clone --mirror")
	}
	return repoPath, nil
}
func checkout(ctx context.Context, workingDir, ref string) error {
	args := []string{"checkout", ref, "--"}
	err := execGitCmd(ctx, args, gitCmdConfig{dir: workingDir})
	if err != nil {
		return err
	}
	return nil
}
func add(ctx context.Context, workingDir, path string) error {
	args := []string{"add", "--", path}
	return execGitCmd(ctx, args, gitCmdConfig{dir: workingDir})
}
func checkPush(ctx context.Context, workingDir, upstream, branch string) error {
	b := make([]byte, 5)
	if _, err := rand.Read(b); err != nil {
		return err
	}
	pseudoRandPushTag := fmt.Sprintf("%s-%x", CheckPushTagPrefix, b)
	args := []string{"tag", pseudoRandPushTag}
	if branch != "" {
		args = append(args, branch)
	}
	if err := execGitCmd(ctx, args, gitCmdConfig{dir: workingDir}); err != nil {
		return errors.Wrap(err, "tag for write check")
	}
	args = []string{"push", upstream, "tag", pseudoRandPushTag}
	if err := execGitCmd(ctx, args, gitCmdConfig{dir: workingDir}); err != nil {
		return errors.Wrap(err, "attempt to push tag")
	}
	return deleteTag(ctx, workingDir, pseudoRandPushTag, upstream)
}