diff options
-rw-r--r-- | options.go | 6 | ||||
-rw-r--r-- | repository.go | 4 | ||||
-rw-r--r-- | repository_test.go | 16 |
3 files changed, 13 insertions, 13 deletions
@@ -385,8 +385,8 @@ var ( ErrMissingMessage = errors.New("message field is required") ) -// TagObjectOptions describes how a tag object should be created. -type TagObjectOptions struct { +// 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 @@ -399,7 +399,7 @@ type TagObjectOptions struct { } // Validate validates the fields and sets the default values. -func (o *TagObjectOptions) Validate(r *Repository, hash plumbing.Hash) error { +func (o *CreateTagOptions) Validate(r *Repository, hash plumbing.Hash) error { if o.Tagger == nil { return ErrMissingTagger } diff --git a/repository.go b/repository.go index 096ec13..a132c39 100644 --- a/repository.go +++ b/repository.go @@ -494,7 +494,7 @@ func (r *Repository) DeleteBranch(name string) error { // CreateTag creates a tag. If opts is included, the tag is an annotated tag, // otherwise a lightweight tag is created. -func (r *Repository) CreateTag(name string, hash plumbing.Hash, opts *TagObjectOptions) (*plumbing.Reference, error) { +func (r *Repository) CreateTag(name string, hash plumbing.Hash, opts *CreateTagOptions) (*plumbing.Reference, error) { rname := plumbing.ReferenceName(path.Join("refs", "tags", name)) _, err := r.Storer.Reference(rname) @@ -527,7 +527,7 @@ func (r *Repository) CreateTag(name string, hash plumbing.Hash, opts *TagObjectO return ref, nil } -func (r *Repository) createTagObject(name string, hash plumbing.Hash, opts *TagObjectOptions) (plumbing.Hash, error) { +func (r *Repository) createTagObject(name string, hash plumbing.Hash, opts *CreateTagOptions) (plumbing.Hash, error) { if err := opts.Validate(r, hash); err != nil { return plumbing.ZeroHash, err } diff --git a/repository_test.go b/repository_test.go index 88ad715..89911c0 100644 --- a/repository_test.go +++ b/repository_test.go @@ -1331,7 +1331,7 @@ func (s *RepositorySuite) TestCreateTagAnnotated(c *C) { expectedHash := h.Hash() - ref, err := r.CreateTag("foobar", expectedHash, &TagObjectOptions{ + ref, err := r.CreateTag("foobar", expectedHash, &CreateTagOptions{ Tagger: defaultSignature(), Message: "foo bar baz qux", }) @@ -1363,13 +1363,13 @@ func (s *RepositorySuite) TestCreateTagAnnotatedBadOpts(c *C) { expectedHash := h.Hash() - ref, err := r.CreateTag("foobar", expectedHash, &TagObjectOptions{ + ref, err := r.CreateTag("foobar", expectedHash, &CreateTagOptions{ Message: "foo bar baz qux", }) c.Assert(ref, IsNil) c.Assert(err, Equals, ErrMissingTagger) - ref, err = r.CreateTag("foobar", expectedHash, &TagObjectOptions{ + ref, err = r.CreateTag("foobar", expectedHash, &CreateTagOptions{ Tagger: defaultSignature(), }) c.Assert(ref, IsNil) @@ -1385,7 +1385,7 @@ func (s *RepositorySuite) TestCreateTagAnnotatedBadHash(c *C) { err := r.clone(context.Background(), &CloneOptions{URL: url}) c.Assert(err, IsNil) - ref, err := r.CreateTag("foobar", plumbing.ZeroHash, &TagObjectOptions{ + ref, err := r.CreateTag("foobar", plumbing.ZeroHash, &CreateTagOptions{ Tagger: defaultSignature(), Message: "foo bar baz qux", }) @@ -1406,7 +1406,7 @@ func (s *RepositorySuite) TestCreateTagSigned(c *C) { c.Assert(err, IsNil) key := commitSignKey(c, true) - _, err = r.CreateTag("foobar", h.Hash(), &TagObjectOptions{ + _, err = r.CreateTag("foobar", h.Hash(), &CreateTagOptions{ Tagger: defaultSignature(), Message: "foo bar baz qux", SignKey: key, @@ -1447,7 +1447,7 @@ func (s *RepositorySuite) TestCreateTagSignedBadKey(c *C) { c.Assert(err, IsNil) key := commitSignKey(c, false) - _, err = r.CreateTag("foobar", h.Hash(), &TagObjectOptions{ + _, err = r.CreateTag("foobar", h.Hash(), &CreateTagOptions{ Tagger: defaultSignature(), Message: "foo bar baz qux", SignKey: key, @@ -1468,7 +1468,7 @@ func (s *RepositorySuite) TestCreateTagCanonicalize(c *C) { c.Assert(err, IsNil) key := commitSignKey(c, true) - _, err = r.CreateTag("foobar", h.Hash(), &TagObjectOptions{ + _, err = r.CreateTag("foobar", h.Hash(), &CreateTagOptions{ Tagger: defaultSignature(), Message: "\n\nfoo bar baz qux\n\nsome message here", SignKey: key, @@ -1637,7 +1637,7 @@ func (s *RepositorySuite) TestDeleteTagAnnotatedUnpacked(c *C) { expectedHash := h.Hash() - ref, err := r.CreateTag("foobar", expectedHash, &TagObjectOptions{ + ref, err := r.CreateTag("foobar", expectedHash, &CreateTagOptions{ Tagger: defaultSignature(), Message: "foo bar baz qux", }) |