Creating new Tags

168 Views Asked by At

Just wondering if it is possible to create a new GIT tag using Rugged. if so, an example would be greatly appreciated.

I'm basically just trying to create/move/delete tags on commit oids.

1

There are 1 best solutions below

2
On BEST ANSWER

You can see some examples in test/tag_test.rb:

@repo = sandbox_init("testrepo.git")
@tag = @repo.tags.create('annotated_tag', "5b5b025afb0b4c913b4c338a42934a3863bf3644", {
  :message => "test tag message\n",
  :tagger => { :name => 'Scott', :email => '[email protected]', :time => Time.now }
})

For deletion, see test/reference_test.rb:

tag = @repo.tags["test"]

@repo.references.delete(tag)
refute @repo.references.exists?("refs/tags/test")

The OP Chris Portman points out in the comments that:

The create/delete methods are actually part of the TagCollection class.
Same with branches and the BranchCollection class.