Comment 5 for bug 1115283

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 1115283] Re: Can't create tags in git repo via dulwich.

On Mon, 2013-02-11 at 07:34 +0000, Ryan Faulkner wrote:
> Thanks Jelmer, the feedback was very helpful.
>
> I ended up creating tags by doing the following:

[... creating commit ... ]

>
> # Build the tag object and tag
> tag = Tag()
> tag.tagger = author
> tag.message = message
> tag.name = tag
> tag.object = (Commit, commit.id)
> tag.tag_time = commit.author_time
> tag.tag_timezone = tz
> object_store.add_object(tag)
This last step shouldn't be necessary. Just this line:
> _repo['refs/tags/' + tag] = tag.id

- with commit rather than tag - should be sufficient. You only need the
tag object if you want to create an annotated tag object.

> This doesn't seem to be included in the documentation. I'm wondering,
> would it be helpful to you if I added this to the tutorial docs then
> sent a pull request to jelmer/dulwich?
Please do. Improvements to the documentation are always welcome :)

Jelmer