code.gitea.io/gitea@v1.22.3/modules/git/signature_nogogit.go (about)

     1  // Copyright 2015 The Gogs Authors. All rights reserved.
     2  // Copyright 2019 The Gitea Authors. All rights reserved.
     3  // SPDX-License-Identifier: MIT
     4  
     5  //go:build !gogit
     6  
     7  package git
     8  
     9  import (
    10  	"fmt"
    11  	"time"
    12  
    13  	"code.gitea.io/gitea/modules/util"
    14  )
    15  
    16  // Signature represents the Author, Committer or Tagger information.
    17  type Signature struct {
    18  	Name  string    // the committer name, it can be anything
    19  	Email string    // the committer email, it can be anything
    20  	When  time.Time // the timestamp of the signature
    21  }
    22  
    23  func (s *Signature) String() string {
    24  	return fmt.Sprintf("%s <%s>", s.Name, s.Email)
    25  }
    26  
    27  // Decode decodes a byte array representing a signature to signature
    28  func (s *Signature) Decode(b []byte) {
    29  	*s = *parseSignatureFromCommitLine(util.UnsafeBytesToString(b))
    30  }