1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 14:52:40 +01:00

If a Git upstream is configured for the current branch, always use that as the default relative commit

Summary: See discussion in D1861.

Test Plan: Ran "arc diff" on master, got an upstream-based relative commit. Ran "arc diff" on a feature branch, got a config-based relative commit. Ran "arc diff x", got an argument-based relative commit.

Reviewers: btrahan, vrana, davidreuss, elgenie

Reviewed By: davidreuss

CC: aran

Differential Revision: https://secure.phabricator.com/D2192
This commit is contained in:
epriestley 2012-04-10 15:33:31 -07:00
parent 2c02e79df4
commit 7ea51b6bb7

View file

@ -128,8 +128,19 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
return $this->relativeCommit;
}
$default_relative = $this->readScratchFile('default-relative-commit');
$do_write = false;
$default_relative = null;
list($err, $upstream) = $this->execManualLocal(
"rev-parse --abbrev-ref --symbolic-full-name '@{upstream}'");
if (!$err) {
$default_relative = trim($upstream);
}
if (!$default_relative) {
$default_relative = $this->readScratchFile('default-relative-commit');
}
if (!$default_relative) {
$working_copy = $this->getWorkingCopyIdentity();