Summary:
A git submodule looks a lot like a normal git repo, but the .git
directory is replaced with a file that git reads to find the real
location of the git directory. When arcanist tries to write a file into
a directory inside of there, it was failing silently, and then crashing
silently when it couldn't read results back out. Instead of assuming the
git directory is a directory named .git at the toplevel of the tree, we
use the appropriate git command to get the correct git directory.
Test Plan: submit a diff from a submodule
Reviewers: epriestley, vrana
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4482
}
public function getMetadataPath() {
- return $this->getPath('.git');
+ static $path = null;
+ if ($path === null) {
+ list($stdout) = $this->execxLocal('rev-parse --git-dir');
+ $path = rtrim($stdout, "\n");
+ // the output of git rev-parse --git-dir is an absolute path, unless
+ // the cwd is the root of the repository, in which case it uses the
+ // relative path of .git. If we get this relative path, turn it into
+ // an absolute path.
+ if ($path === '.git') {
+ $path = $this->getPath('.git');
+ }
+ }
+ return $path;
}
public function getHasCommits() {
list($err) = $lint_unit->resolve();
$data = $this->readScratchJSONFile('diff-result.json');
if ($err || !$data) {
- return 1;
+ throw new Exception(
+ 'Unable to read results from background linting and unit testing. '.
+ 'You can try running arc diff again with --background 0');
}
} else {
$server = $this->console->getServer();