mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 21:44:23 +01:00
single commit and bumping go-git version
This commit is contained in:
1 parent
3b45fb91e3
commit
15dedda59a
48 files changed
+1453
-390
No files matched your search
+51
-4
@@ -3,6 +3,7 @@ package git
|
||||
import (
|
||||
"errors"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/crypto/openpgp"
|
||||
"gopkg.in/src-d/go-git.v4/config"
|
||||
@@ -230,8 +231,9 @@ var (
|
||||
|
||||
// CheckoutOptions describes how a checkout 31operation should be performed.
|
||||
type CheckoutOptions struct {
|
||||
// Hash to be checked out, if used HEAD will in detached mode. Branch and
|
||||
// Hash are mutually exclusive, if Create is not used.
|
||||
// Hash is the hash of the commit to be checked out. If used, HEAD will be
|
||||
// in detached mode. If Create is not used, Branch and Hash are mutually
|
||||
// exclusive.
|
||||
Hash plumbing.Hash
|
||||
// Branch to be checked out, if Branch and Hash are empty is set to `master`.
|
||||
Branch plumbing.ReferenceName
|
||||
@@ -329,6 +331,15 @@ type LogOptions struct {
|
||||
// set Order=LogOrderCommitterTime for ordering by committer time (more compatible with `git log`)
|
||||
// set Order=LogOrderBSF for Breadth-first search
|
||||
Order LogOrder
|
||||
|
||||
// Show only those commits in which the specified file was inserted/updated.
|
||||
// It is equivalent to running `git log -- <file-name>`.
|
||||
FileName *string
|
||||
|
||||
// Pretend as if all the refs in refs/, along with HEAD, are listed on the command line as <commit>.
|
||||
// It is equivalent to running `git log --all`.
|
||||
// If set on true, the From option will be ignored.
|
||||
All bool
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -348,8 +359,9 @@ type CommitOptions struct {
|
||||
// Parents are the parents commits for the new commit, by default when
|
||||
// len(Parents) is zero, the hash of HEAD reference is used.
|
||||
Parents []plumbing.Hash
|
||||
// A key to sign the commit with. A nil value here means the commit will not
|
||||
// be signed. The private key must be present and already decrypted.
|
||||
// SignKey denotes a key to sign the commit with. A nil value here means the
|
||||
// commit will not be signed. The private key must be present and already
|
||||
// decrypted.
|
||||
SignKey *openpgp.Entity
|
||||
}
|
||||
|
||||
@@ -377,6 +389,41 @@ func (o *CommitOptions) Validate(r *Repository) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
ErrMissingName = errors.New("name field is required")
|
||||
ErrMissingTagger = errors.New("tagger field is required")
|
||||
ErrMissingMessage = errors.New("message field is required")
|
||||
)
|
||||
|
||||
// CreateTagOptions describes how a tag object should be created.
|
||||
type CreateTagOptions struct {
|
||||
// Tagger defines the signature of the tag creator.
|
||||
Tagger *object.Signature
|
||||
// Message defines the annotation of the tag. It is canonicalized during
|
||||
// validation into the format expected by git - no leading whitespace and
|
||||
// ending in a newline.
|
||||
Message string
|
||||
// SignKey denotes a key to sign the tag with. A nil value here means the tag
|
||||
// will not be signed. The private key must be present and already decrypted.
|
||||
SignKey *openpgp.Entity
|
||||
}
|
||||
|
||||
// Validate validates the fields and sets the default values.
|
||||
func (o *CreateTagOptions) Validate(r *Repository, hash plumbing.Hash) error {
|
||||
if o.Tagger == nil {
|
||||
return ErrMissingTagger
|
||||
}
|
||||
|
||||
if o.Message == "" {
|
||||
return ErrMissingMessage
|
||||
}
|
||||
|
||||
// Canonicalize the message into the expected message format.
|
||||
o.Message = strings.TrimSpace(o.Message) + "\n"
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ListOptions describes how a remote list should be performed.
|
||||
type ListOptions struct {
|
||||
// Auth credentials, if required, to use with the remote repository.
|
||||
|
||||
Reference in new issue
Block a user