1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00
phorge-phorge/scripts
Arturas Moskvinas 4c09e88c95 Add parsing for ssh options (-o) which are passed when using GIT v2 wire protocol by git command (SSH transport)
Summary:
Makes `ssh-connect` compatible with Git v2 wire protocol over SSH

More details about git V2 wire: https://opensource.googleblog.com/2018/05/introducing-git-protocol-version-2.html

`git` command (2.18+) passes extra options (`-o "SendEnv GIT_PROTOCOL"`) to underlying `ssh` command to enable v2 wire protocol (environment variable enabling new protocol).

Phabricator `ssh-connect` command doesn't understand `-o` options and interprets it as host parts hence when you enable git v2 all clones/ls-remotes crash with:
```
#0 ExecFuture::resolvex() called at [<phabricator>/src/applications/repository/storage/PhabricatorRepository.php:525]
#1 PhabricatorRepository::execxRemoteCommand(string, PhutilOpaqueEnvelope) called at [<phabricator>/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php:400]
#2 PhabricatorRepositoryPullEngine::loadGitRemoteRefs(PhabricatorRepository) called at [<phabricator>/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php:343]
#3 PhabricatorRepositoryPullEngine::executeGitUpdate() called at [<phabricator>/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php:126]
#4 PhabricatorRepositoryPullEngine::pullRepositoryWithLock() called at [<phabricator>/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php:40]
#5 PhabricatorRepositoryPullEngine::pullRepository() called at [<phabricator>/src/applications/repository/management/PhabricatorRepositoryManagementUpdateWorkflow.php:59]
#6 PhabricatorRepositoryManagementUpdateWorkflow::execute(PhutilArgumentParser) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:441]
#7 PhutilArgumentParser::parseWorkflowsFull(array) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:333]
#8 PhutilArgumentParser::parseWorkflows(array) called at [<phabricator>/scripts/repository/manage_repositories.php:22]
COMMAND
git ls-remote '********'
STDOUT
(empty)
STDERR
ssh: Could not resolve hostname -o: Name or service not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
at [<phutil>/src/future/exec/ExecFuture.php:369]
```

Test Plan:
How to reproduce:
1. add repository to Phabricator which is accessed via `ssh`
2. Use git 2.18+
3. Enable wire protocol in `/etc/gitconfig`:
```
[protocol]
    version = 2
```
4. Try refreshing repository: `phabricator/bin/repository update somecallsing`
5. Repository update fails with `ssh: Could not resolve hostname -o: Name or service not known`

after this changes - updates will succeed

Reviewers: epriestley, Pawka, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D19542
2018-08-02 16:42:59 +03:00
..
almanac Use PhutilClassMapQuery instead of PhutilSymbolLoader 2015-08-14 07:49:01 +10:00
cache Use PhutilClassMapQuery instead of PhutilSymbolLoader 2015-08-14 07:49:01 +10:00
celerity Add some sort of sort to Emoji Autocomplete 2017-01-24 20:21:06 -08:00
daemon When available, use async_signals in Phabricator 2017-01-12 16:00:13 -08:00
diviner Use PhutilClassMapQuery instead of PhutilSymbolLoader 2015-08-14 07:49:01 +10:00
drydock When bin/drydock lease is interrupted, release leases 2018-02-13 13:14:21 -08:00
fact Use PhutilClassMapQuery instead of PhutilSymbolLoader 2015-08-14 07:49:01 +10:00
files Use PhutilClassMapQuery instead of PhutilSymbolLoader 2015-08-14 07:49:01 +10:00
fpm Delete license headers from files 2012-11-05 11:16:51 -08:00
init When bin/drydock lease is interrupted, release leases 2018-02-13 13:14:21 -08:00
install Update install_ubuntu.sh to the new age 2018-04-21 09:57:33 -07:00
lipsum Improve bin/lipsum UX 2015-12-24 09:06:35 -08:00
mail Fix inbound mail handling for messages with no HTML body part 2017-11-22 11:14:24 -08:00
people Add a profileimage generation workflow for the cli 2017-03-04 15:43:13 -08:00
repository Generate a random unique "Request ID" for SSH requests so processes can coordinate better 2018-03-22 13:44:30 -07:00
search Use PhutilClassMapQuery instead of PhutilSymbolLoader 2015-08-14 07:49:01 +10:00
setup Add a "lock log" for debugging where locks are being held 2018-03-05 17:55:34 -08:00
sms Use PhutilClassMapQuery instead of PhutilSymbolLoader 2015-08-14 07:49:01 +10:00
sql Respect user/pass flags to bin/storage for direct DatabaseRef-based queries 2016-11-19 08:39:45 -08:00
ssh Add parsing for ssh options (-o) which are passed when using GIT v2 wire protocol by git command (SSH transport) 2018-08-02 16:42:59 +03:00
symbols Update import/clear symbols scripts for callsigns 2016-02-18 09:55:57 -08:00
user Remove "set password" from bin/accountadmin and let bin/auth recover recover anyone 2018-01-23 10:58:11 -08:00
util phtize all the things 2015-05-22 21:16:39 +10:00
__init_script__.php Continue on bad database configuration from select scripts 2016-09-06 14:20:57 -07:00
manage_bulk.php Allow bulk edits to be made silently if you have CLI access 2018-01-19 13:24:54 -08:00