Skip to content

Fix accessing deleted files in older revisions #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function fetchFile($path, $revision = null)

$url = $path . '?view=co';
if ($revision !== null) {
$url .= '&revision=' . $revision;
$url .= '&pathrev=' . $revision;
}

// TODO: fetching a directory redirects to path with trailing slash
Expand Down
9 changes: 9 additions & 0 deletions tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,13 @@ public function testFetchFileExcessiveSlashesAreIgnored()

$this->expectPromiseReject($promise);
}

public function testFetchFileRevision()
{
$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()));

$promise = $this->client->fetchFile('/README.md', '1.0');

$this->expectPromiseReject($promise);
}
}
11 changes: 11 additions & 0 deletions tests/FunctionalClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ public function testFetchFile()
$this->assertStringStartsWith('/*', $recipe);
}

public function testFetchFileOldFileNowDeletedButRevisionAvailable()
{
$file = 'commons/STATUS';
$revision = '1';

$promise = $this->viewvc->fetchFile($file, $revision);
$contents = $this->waitFor($promise);

$this->assertStringStartsWith('APACHE COMMONS', $contents);
}

/**
* @expectedException RuntimeException
*/
Expand Down