Skip to content

Commit aa04751

Browse files
committed
Merge pull request #6 from clue-labs/deleted
Fix accessing deleted files in older revisions
2 parents 05403e5 + ac1c75f commit aa04751

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function fetchFile($path, $revision = null)
4545

4646
$url = $path . '?view=co';
4747
if ($revision !== null) {
48-
$url .= '&revision=' . $revision;
48+
$url .= '&pathrev=' . $revision;
4949
}
5050

5151
// TODO: fetching a directory redirects to path with trailing slash

tests/ClientTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,13 @@ public function testFetchFileExcessiveSlashesAreIgnored()
4848

4949
$this->expectPromiseReject($promise);
5050
}
51+
52+
public function testFetchFileRevision()
53+
{
54+
$this->browser->expects($this->once())->method('get')->with($this->equalTo('http://viewvc.example.org/README.md?view=co&pathrev=1.0'))->will($this->returnValue($this->createPromiseRejected()));
55+
56+
$promise = $this->client->fetchFile('/README.md', '1.0');
57+
58+
$this->expectPromiseReject($promise);
59+
}
5160
}

tests/FunctionalClientTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ public function testFetchFile()
4444
$this->assertStringStartsWith('/*', $recipe);
4545
}
4646

47+
public function testFetchFileOldFileNowDeletedButRevisionAvailable()
48+
{
49+
$file = 'commons/STATUS';
50+
$revision = '1';
51+
52+
$promise = $this->viewvc->fetchFile($file, $revision);
53+
$contents = $this->waitFor($promise);
54+
55+
$this->assertStringStartsWith('APACHE COMMONS', $contents);
56+
}
57+
4758
/**
4859
* @expectedException RuntimeException
4960
*/

0 commit comments

Comments
 (0)