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 /repository.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 'repository.go')
-rw-r--r-- | repository.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/repository.go b/repository.go index ab14eba..6da15a1 100644 --- a/repository.go +++ b/repository.go @@ -532,11 +532,16 @@ func (r *Repository) createTagObject(name string, hash plumbing.Hash, opts *TagO return plumbing.ZeroHash, err } + rawobj, err := object.GetObject(r.Storer, hash) + if err != nil { + return plumbing.ZeroHash, err + } + tag := &object.Tag{ Name: name, Tagger: *opts.Tagger, Message: opts.Message, - TargetType: opts.TargetType, + TargetType: rawobj.Type(), Target: hash, } |