1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 16:22:42 +01:00

Always use git.default-relative-commit, if present

Summary:
Always use the value in git.default-relative-commit when getting the relative
commit in git.

Test Plan:
Ran arc diff in a repo with git.default-relative-commit set to HEAD^ on a
branch tracking a remote (that is different from HEAD^), and checked that
the diff against HEAD^, not the remote, was published.

Reviewers: jungejason, epriestley, vrana

Reviewed By: epriestley

CC: aran, Koolvin

Differential Revision: https://secure.phabricator.com/D2409
This commit is contained in:
Nick Harper 2012-05-06 17:03:32 -07:00
parent 0253bb9475
commit 6fcd2db646

View file

@ -130,12 +130,19 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
$do_write = false;
$default_relative = null;
$working_copy = $this->getWorkingCopyIdentity();
if ($working_copy) {
$default_relative = $working_copy->getConfig(
'git.default-relative-commit');
}
list($err, $upstream) = $this->execManualLocal(
"rev-parse --abbrev-ref --symbolic-full-name '@{upstream}'");
if (!$default_relative) {
list($err, $upstream) = $this->execManualLocal(
"rev-parse --abbrev-ref --symbolic-full-name '@{upstream}'");
if (!$err) {
$default_relative = trim($upstream);
if (!$err) {
$default_relative = trim($upstream);
}
}
if (!$default_relative) {
@ -143,14 +150,6 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
$default_relative = trim($default_relative);
}
if (!$default_relative) {
$working_copy = $this->getWorkingCopyIdentity();
if ($working_copy) {
$default_relative = $working_copy->getConfig(
'git.default-relative-commit');
}
}
if (!$default_relative) {
// TODO: Remove the history lesson soon.