Skip to content

Commit

Permalink
added method rename()
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Pecha <[email protected]>
  • Loading branch information
janpecha committed Apr 19, 2013
1 parent e47b135 commit 0cbdd5c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Git.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,32 @@ public function add($file)



/**
* Renames file(s).
* @param string|string[] from: array('from' => 'to', ...) || (from, to)
* @param string|NULL
* @throws Cz\Git\GitException
* @return Cz\Git\Git
*/
public function rename($file, $to = NULL)
{
if(!is_array($file)) // rename(file, to);
{
$from[$file] = $to;
$file = $from;
unset($from);
}

foreach($file as $from => $to)
{
$this->run('git mv', $from, $to);
}

return $this;
}



/**
* Commits changes
* @param string
Expand Down
10 changes: 10 additions & 0 deletions IGit.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ public function add($file);



/**
* Renames file(s).
* @param string|string[] from: array('from' => 'to', ...) || (from, to)
* @param string|NULL
* @throws Cz\Git\GitException
*/
public function rename($file, $to = NULL);



/**
* Commits changes
* @param string
Expand Down

0 comments on commit 0cbdd5c

Please sign in to comment.