MCPcopy Index your code
hub / github.com/git/git / push_ssh_options

Function push_ssh_options

connect.c:1281–1339  ·  view source on GitHub ↗

* Append the appropriate environment variables to `env` and options to * `args` for running ssh in Git's SSH-tunneled transport. */

Source from the content-addressed store, hash-verified

1279 * `args` for running ssh in Git's SSH-tunneled transport.
1280 */
1281static void push_ssh_options(struct strvec *args, struct strvec *env,
1282 enum ssh_variant variant, const char *port,
1283 enum protocol_version version, int flags)
1284{
1285 if (variant == VARIANT_SSH &&
1286 version > 0) {
1287 strvec_push(args, "-o");
1288 strvec_push(args, "SendEnv=" GIT_PROTOCOL_ENVIRONMENT);
1289 strvec_pushf(env, GIT_PROTOCOL_ENVIRONMENT "=version=%d",
1290 version);
1291 }
1292
1293 if (flags & CONNECT_IPV4) {
1294 switch (variant) {
1295 case VARIANT_AUTO:
1296 BUG("VARIANT_AUTO passed to push_ssh_options");
1297 case VARIANT_SIMPLE:
1298 die(_("ssh variant 'simple' does not support -4"));
1299 case VARIANT_SSH:
1300 case VARIANT_PLINK:
1301 case VARIANT_PUTTY:
1302 case VARIANT_TORTOISEPLINK:
1303 strvec_push(args, "-4");
1304 }
1305 } else if (flags & CONNECT_IPV6) {
1306 switch (variant) {
1307 case VARIANT_AUTO:
1308 BUG("VARIANT_AUTO passed to push_ssh_options");
1309 case VARIANT_SIMPLE:
1310 die(_("ssh variant 'simple' does not support -6"));
1311 case VARIANT_SSH:
1312 case VARIANT_PLINK:
1313 case VARIANT_PUTTY:
1314 case VARIANT_TORTOISEPLINK:
1315 strvec_push(args, "-6");
1316 }
1317 }
1318
1319 if (variant == VARIANT_TORTOISEPLINK)
1320 strvec_push(args, "-batch");
1321
1322 if (port) {
1323 switch (variant) {
1324 case VARIANT_AUTO:
1325 BUG("VARIANT_AUTO passed to push_ssh_options");
1326 case VARIANT_SIMPLE:
1327 die(_("ssh variant 'simple' does not support setting port"));
1328 case VARIANT_SSH:
1329 strvec_push(args, "-p");
1330 break;
1331 case VARIANT_PLINK:
1332 case VARIANT_PUTTY:
1333 case VARIANT_TORTOISEPLINK:
1334 strvec_push(args, "-P");
1335 }
1336
1337 strvec_push(args, port);
1338 }

Callers 1

fill_ssh_argsFunction · 0.85

Calls 3

strvec_pushFunction · 0.85
strvec_pushfFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected