Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F87537
D7680.diff
All Users
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
D7680.diff
View Options
diff --git a/scripts/ssh/ssh-connect.php b/scripts/ssh/ssh-connect.php
--- a/scripts/ssh/ssh-connect.php
+++ b/scripts/ssh/ssh-connect.php
@@ -7,6 +7,20 @@
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
+// Contrary to the documentation, Git may pass a "-p" flag. If it does, respect
+// it and move it before the "--" argument.
+$args = new PhutilArgumentParser($argv);
+$args->parsePartial(
+ array(
+ array(
+ 'name' => 'port',
+ 'short' => 'p',
+ 'param' => pht('port'),
+ 'help' => pht('Port number to connect to.'),
+ ),
+ ));
+$unconsumed_argv = $args->getUnconsumedArgumentVector();
+
$pattern = array();
$arguments = array();
@@ -31,9 +45,15 @@
$arguments[] = $key->getKeyfileEnvelope();
}
+$port = $args->getArg('port');
+if ($port) {
+ $pattern[] = '-p %d';
+ $arguments[] = $port;
+}
+
$pattern[] = '--';
-$passthru_args = array_slice($argv, 1);
+$passthru_args = $unconsumed_argv;
foreach ($passthru_args as $passthru_arg) {
$pattern[] = '%s';
$arguments[] = $passthru_arg;
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/ye/2p/b56h6slruw5vg7xp
Default Alt Text
D7680.diff (1 KB)
Attached To
Mode
D7680: Handle "-p port" flag in ssh-connect
Attached
Detach File
Event Timeline
Log In to Comment