diff options
author | Chris Marchesi <chrism@vancluevertech.com> | 2018-08-23 10:14:21 -0700 |
---|---|---|
committer | Chris Marchesi <chrism@vancluevertech.com> | 2018-08-23 10:14:21 -0700 |
commit | 119459a6b9ddaa244f76f67b182bf2c627434d02 (patch) | |
tree | 611bf3d9f65a3f688f9456b4cc029f78ec46e94c /options.go | |
parent | 8d8d4c52f42d5e5e7eccd8e51671b7d73d331ea0 (diff) | |
download | go-git-119459a6b9ddaa244f76f67b182bf2c627434d02.tar.gz |
git: Discern tag target type from supplied hash
I figured there was a way to do this without having to have
TagObjectOptions supply this in - there is.
Added support for this in and removed the object type from
TagObjectOptions.
Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
Diffstat (limited to 'options.go')
-rw-r--r-- | options.go | 12 |
1 files changed, 0 insertions, 12 deletions
@@ -383,7 +383,6 @@ var ( ErrMissingName = errors.New("name field is required") ErrMissingTagger = errors.New("tagger field is required") ErrMissingMessage = errors.New("message field is required") - ErrBadObjectType = errors.New("bad object type for tagging") ) // TagObjectOptions describes how a tag object should be created. @@ -394,9 +393,6 @@ type TagObjectOptions struct { // validation into the format expected by git - no leading whitespace and // ending in a newline. Message string - // TargetType is the object type of the target. The object specified by - // Target must be of this type. - TargetType plumbing.ObjectType // 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 @@ -415,14 +411,6 @@ func (o *TagObjectOptions) Validate(r *Repository, hash plumbing.Hash) error { // Canonicalize the message into the expected message format. o.Message = strings.TrimSpace(o.Message) + "\n" - if o.TargetType == plumbing.InvalidObject || o.TargetType == plumbing.AnyObject { - return ErrBadObjectType - } - - if _, err := r.Object(o.TargetType, hash); err != nil { - return err - } - return nil } |