aboutsummaryrefslogtreecommitdiffstats
path: root/options.go
diff options
context:
space:
mode:
authorChris Marchesi <chrism@vancluevertech.com>2018-08-23 10:14:21 -0700
committerChris Marchesi <chrism@vancluevertech.com>2018-08-23 10:14:21 -0700
commit119459a6b9ddaa244f76f67b182bf2c627434d02 (patch)
tree611bf3d9f65a3f688f9456b4cc029f78ec46e94c /options.go
parent8d8d4c52f42d5e5e7eccd8e51671b7d73d331ea0 (diff)
downloadgo-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.go12
1 files changed, 0 insertions, 12 deletions
diff --git a/options.go b/options.go
index ed0baa3..856bd5e 100644
--- a/options.go
+++ b/options.go
@@ -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
}