mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-04 12:42:43 +01:00
7360688afb
Summary: Fixes T4035. I removed these two "remote/" things in rP59922b7, but we need them for non-bare repositories. Without them, the commands work and run fine and the output looks OK, but the results may not reflect the correct information (e.g., the log shows the working copy's master, which may not be in the same state as origin/master). I'm going to generally clean this up, but unbreak it for now. Test Plan: Viewed bare and non-bare repositories in Diffusion, got accurate history. Reviewers: btrahan, hach-que Reviewed By: btrahan CC: aran, mbishopim3 Maniphest Tasks: T4035 Differential Revision: https://secure.phabricator.com/D7445
43 lines
833 B
PHP
43 lines
833 B
PHP
<?php
|
|
|
|
/**
|
|
* @group diffusion
|
|
*/
|
|
final class DiffusionGitRequest extends DiffusionRequest {
|
|
|
|
protected function getSupportsBranches() {
|
|
return true;
|
|
}
|
|
|
|
protected function didInitialize() {
|
|
if (!$this->commit) {
|
|
return;
|
|
}
|
|
|
|
$this->expandCommitName();
|
|
}
|
|
|
|
public function getBranch() {
|
|
if ($this->branch) {
|
|
return $this->branch;
|
|
}
|
|
if ($this->repository) {
|
|
return $this->repository->getDefaultBranch();
|
|
}
|
|
throw new Exception("Unable to determine branch!");
|
|
}
|
|
|
|
public function getCommit() {
|
|
if ($this->commit) {
|
|
return $this->commit;
|
|
}
|
|
|
|
if ($this->repository->isWorkingCopyBare()) {
|
|
return $this->getBranch();
|
|
} else {
|
|
$remote = DiffusionBranchInformation::DEFAULT_GIT_REMOTE;
|
|
return $remote.'/'.$this->getBranch();
|
|
}
|
|
}
|
|
|
|
}
|