Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14003850
D13998.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13998.diff
View Options
diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php
--- a/src/repository/api/ArcanistGitAPI.php
+++ b/src/repository/api/ArcanistGitAPI.php
@@ -51,6 +51,11 @@
return 'git';
}
+ public function getGitVersion() {
+ list($stdout) = $this->execxLocal('--version');
+ return rtrim(str_replace('git version ', '', $stdout));
+ }
+
public function getMetadataPath() {
static $path = null;
if ($path === null) {
@@ -516,10 +521,21 @@
}
public function getRemoteURI() {
- list($stdout) = $this->execxLocal('ls-remote --get-url origin');
+ // "git ls-remote --get-url" is the appropriate plumbing to get the remote
+ // URI. "git config remote.origin.url", on the other hand, may not be as
+ // accurate (for example, it does not take into account possible URL
+ // rewriting rules set by the user through "url.<base>.insteadOf"). However,
+ // the --get-url flag requires git 1.7.5.
+ $version = $this->getGitVersion();
+ if (version_compare($version, '1.7.5', '>=')) {
+ list($stdout) = $this->execxLocal('ls-remote --get-url origin');
+ } else {
+ list($stdout) = $this->execxLocal('config remote.origin.url');
+ }
$uri = rtrim($stdout);
- if ($uri === 'origin') {
+ // 'origin' is what ls-remote outputs if no origin remote URI exists
+ if (!$uri || $uri === 'origin') {
return null;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 27, 11:31 AM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6725738
Default Alt Text
D13998.diff (1 KB)
Attached To
Mode
D13998: Use 'remote.origin.url' fallback for git < 1.7.5
Attached
Detach File
Event Timeline
Log In to Comment