Skip to content

Commit 72b5672

Browse files
author
Alexandre Salomé
committed
Merge pull request #27 from gitonomy/feat-diff
Added Diff::getRawDiff
2 parents 601ae1d + d9ea030 commit 72b5672

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/Gitonomy/Git/Diff.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ class Diff
3939
*/
4040
protected $isTree;
4141

42+
/**
43+
* @var string
44+
*/
45+
protected $rawDiff;
46+
4247
/**
4348
* Constructs a new diff for a given revision.
4449
*
@@ -65,11 +70,11 @@ protected function initialize()
6570
{
6671
$args = array('-r', '-p', '-m', '-M', '--no-commit-id', '--full-index');
6772
$args = array_merge($args, $this->revisions);
68-
$result = $this->repository->run($this->isTree ? 'diff-tree' : 'diff', $args);
73+
$this->rawDiff = $this->repository->run($this->isTree ? 'diff-tree' : 'diff', $args);
6974

7075
$parser = new Parser\DiffParser();
7176
$parser->setRepository($this->repository);
72-
$parser->parse($result);
77+
$parser->parse($this->rawDiff);
7378

7479
$this->files = $parser->files;
7580
}
@@ -85,4 +90,16 @@ public function getFiles()
8590

8691
return $this->files;
8792
}
93+
94+
/**
95+
* Get raw diff
96+
*
97+
* @return string The raw diff
98+
*/
99+
public function getRawDiff()
100+
{
101+
$this->initialize();
102+
103+
return $this->rawDiff;
104+
}
88105
}

0 commit comments

Comments
 (0)