mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 16:22:42 +01:00
Fix arc ArcanistSvnHookPreCommitWorkflow
Summary: there are two problems making the ArcanistSvnHookPreCommitWorkflow not working. - pathExists($path) will always return false because it hasn't loaded the path yet. Because of this, PhutilLintEngine will unset the path at https://secure.phabricator.com/diffusion/ARC/browse/master/src/lint/engine/phutil/PhutilLintEngine.php;032b9b30b0721c3f$46, so ArcanistSvnHookPreCommitWorkflow will have no path to lint against and never detects a problem. - In ArcanistSubversionHookAPI::getCurrentFileData(), the $path is already the full path in svnroot (path got from https://secure.phabricator.com/diffusion/ARC/browse/master/src/workflow/svn-hook-pre-commit/ArcanistSvnHookPreCommitWorkflow.php;032b9b30b0721c3f$72). Prepending the project root to it will make the file path to be wrong so that the file content is empty. Again, ArcanistSvnHookPreCommitWorkflow never detects a problem. Test Plan: changed --transaction to --revision in related code and manually ran the following command. It detected the syntaxt error correctly. 558937 is a revision with syntax error. /usr/local/bin/php -f /home/jungejason/nfs_devtools/arcanist/bin/arc svn-hook-pre-commit --load-phutil-library=/tmp/testwww/www/lib/arcanist --load-phutil-library=/home/jungejason/nfs_devtools/facebook/src /svnroot 558937 2>&1 Reviewers: epriestley, nh Reviewed By: nh CC: aran, Girish, Koolvin Differential Revision: https://secure.phabricator.com/D2485
This commit is contained in:
parent
2c72779c7d
commit
ed7034ab38
2 changed files with 3 additions and 2 deletions
|
@ -141,7 +141,8 @@ abstract class ArcanistLintEngine {
|
|||
|
||||
public function pathExists($path) {
|
||||
if ($this->getCommitHookMode()) {
|
||||
return (idx($this->fileData, $path) !== null);
|
||||
$file_data = $this->loadData($path);
|
||||
return ($file_data !== null);
|
||||
} else {
|
||||
$disk_path = $this->getFilePathOnDisk($path);
|
||||
return Filesystem::pathExists($disk_path);
|
||||
|
|
|
@ -36,7 +36,7 @@ final class ArcanistSubversionHookAPI extends ArcanistHookAPI {
|
|||
'svnlook cat --transaction %s %s %s',
|
||||
$this->transaction,
|
||||
$this->repository,
|
||||
$this->root . "/$path");
|
||||
$path);
|
||||
|
||||
return ($err? null : $file);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue