Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/storage/PhabricatorRepository.php
Show First 20 Lines • Show All 1,512 Lines • ▼ Show 20 Lines | if (!$this->isHosted()) { | ||||
} | } | ||||
} | } | ||||
$serve_http = $this->getServeOverHTTP(); | $serve_http = $this->getServeOverHTTP(); | ||||
if ($serve_http === self::SERVE_OFF) { | if ($serve_http === self::SERVE_OFF) { | ||||
return null; | return null; | ||||
} | } | ||||
return $this->getRawHTTPCloneURIObject(); | |||||
} | |||||
private function getRawHTTPCloneURIObject() { | |||||
$uri = PhabricatorEnv::getProductionURI($this->getURI()); | $uri = PhabricatorEnv::getProductionURI($this->getURI()); | ||||
$uri = new PhutilURI($uri); | $uri = new PhutilURI($uri); | ||||
if ($this->isGit()) { | if ($this->isGit()) { | ||||
$uri->setPath($uri->getPath().$this->getCloneName().'.git'); | $uri->setPath($uri->getPath().$this->getCloneName().'.git'); | ||||
} else if ($this->isHg()) { | } else if ($this->isHg()) { | ||||
$uri->setPath($uri->getPath().$this->getCloneName().'/'); | $uri->setPath($uri->getPath().$this->getCloneName().'/'); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 285 Lines • ▼ Show 20 Lines | $default_path = PhabricatorEnv::getEnvConfig( | ||||
'repository.default-local-path'); | 'repository.default-local-path'); | ||||
return Filesystem::isDescendant($this->getLocalPath(), $default_path); | return Filesystem::isDescendant($this->getLocalPath(), $default_path); | ||||
} | } | ||||
public function canUsePathTree() { | public function canUsePathTree() { | ||||
return !$this->isSVN(); | return !$this->isSVN(); | ||||
} | } | ||||
public function canUseGitLFS() { | |||||
if (!$this->isGit()) { | |||||
return false; | |||||
} | |||||
if (!$this->isHosted()) { | |||||
return false; | |||||
} | |||||
// TODO: Unprototype this feature. | |||||
if (!PhabricatorEnv::getEnvConfig('phabricator.show-prototypes')) { | |||||
return false; | |||||
} | |||||
return true; | |||||
} | |||||
public function getGitLFSURI($path = null) { | |||||
if (!$this->canUseGitLFS()) { | |||||
throw new Exception( | |||||
pht( | |||||
'This repository does not support Git LFS, so Git LFS URIs can '. | |||||
'not be generated for it.')); | |||||
} | |||||
$uri = $this->getRawHTTPCloneURIObject(); | |||||
$uri = (string)$uri; | |||||
$uri = $uri.'/'.$path; | |||||
return $uri; | |||||
} | |||||
public function canMirror() { | public function canMirror() { | ||||
if ($this->isGit() || $this->isHg()) { | if ($this->isGit() || $this->isHg()) { | ||||
return true; | return true; | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 584 Lines • Show Last 20 Lines |