mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-29 10:12:41 +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:
parent
0253bb9475
commit
6fcd2db646
1 changed files with 11 additions and 12 deletions
|
@ -130,27 +130,26 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
|
||||||
|
|
||||||
$do_write = false;
|
$do_write = false;
|
||||||
$default_relative = null;
|
$default_relative = null;
|
||||||
|
$working_copy = $this->getWorkingCopyIdentity();
|
||||||
|
if ($working_copy) {
|
||||||
|
$default_relative = $working_copy->getConfig(
|
||||||
|
'git.default-relative-commit');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$default_relative) {
|
||||||
list($err, $upstream) = $this->execManualLocal(
|
list($err, $upstream) = $this->execManualLocal(
|
||||||
"rev-parse --abbrev-ref --symbolic-full-name '@{upstream}'");
|
"rev-parse --abbrev-ref --symbolic-full-name '@{upstream}'");
|
||||||
|
|
||||||
if (!$err) {
|
if (!$err) {
|
||||||
$default_relative = trim($upstream);
|
$default_relative = trim($upstream);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!$default_relative) {
|
if (!$default_relative) {
|
||||||
$default_relative = $this->readScratchFile('default-relative-commit');
|
$default_relative = $this->readScratchFile('default-relative-commit');
|
||||||
$default_relative = trim($default_relative);
|
$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) {
|
if (!$default_relative) {
|
||||||
|
|
||||||
// TODO: Remove the history lesson soon.
|
// TODO: Remove the history lesson soon.
|
||||||
|
|
Loading…
Reference in a new issue