Skip to content

Commit

Permalink
GitRepository: createTag() - added parameter $options
Browse files Browse the repository at this point in the history
It allows creating tags like `git tag -a -m "Tagging version v2.1.0" "v2.1.0"`
  • Loading branch information
ribeiropaulor authored and janpecha committed Feb 7, 2018
1 parent cce1f2e commit 97ef13c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ $repo->getTags();

// creates new tag
$repo->createTag('v1.0.0');
$repo->createTag('v1.0.0', $options);
$repo->createTag('v1.0.0', array(
'-m' => 'message',
));

// renames tag
$repo->renameTag('old-tag-name', 'new-tag-name');
Expand Down
5 changes: 3 additions & 2 deletions src/GitRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ public function getRepositoryPath()
* Creates a tag.
* `git tag <name>`
* @param string
* @param array|NULL
* @throws Cz\Git\GitException
* @return self
*/
public function createTag($name)
public function createTag($name, $options = NULL)
{
return $this->begin()
->run('git tag', $name)
->run('git tag', $options, $name)
->end();
}

Expand Down
3 changes: 2 additions & 1 deletion src/IGit.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ interface IGit
/**
* Creates a tag.
* @param string
* @param array|NULL
* @throws Cz\Git\GitException
*/
function createTag($name);
function createTag($name, $options = NULL);


/**
Expand Down

0 comments on commit 97ef13c

Please sign in to comment.