github.com/argoproj/argo-cd@v1.8.7/test/fixture/revision_metadata/author.go (about)

     1  package revision_metadata
     2  
     3  import (
     4  	"fmt"
     5  	"strings"
     6  
     7  	argoexec "github.com/argoproj/pkg/exec"
     8  
     9  	"github.com/argoproj/argo-cd/util/errors"
    10  )
    11  
    12  var Author string
    13  
    14  func init() {
    15  	userName, err := argoexec.RunCommand("git", argoexec.CmdOpts{}, "config", "--get", "user.name")
    16  	errors.CheckError(err)
    17  	userEmail, err := argoexec.RunCommand("git", argoexec.CmdOpts{}, "config", "--get", "user.email")
    18  	errors.CheckError(err)
    19  	Author = fmt.Sprintf("%s <%s>", strings.TrimSpace(userName), strings.TrimSpace(userEmail))
    20  }