MCPcopy Create free account
hub / github.com/git/git / git_push_config

Function git_push_config

builtin/push.c:489–546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

487
488
489static int git_push_config(const char *k, const char *v,
490 const struct config_context *ctx, void *cb)
491{
492 const char *slot_name;
493 int *flags = cb;
494
495 if (!strcmp(k, "push.followtags")) {
496 if (git_config_bool(k, v))
497 *flags |= TRANSPORT_PUSH_FOLLOW_TAGS;
498 else
499 *flags &= ~TRANSPORT_PUSH_FOLLOW_TAGS;
500 return 0;
501 } else if (!strcmp(k, "push.autosetupremote")) {
502 if (git_config_bool(k, v))
503 *flags |= TRANSPORT_PUSH_AUTO_UPSTREAM;
504 return 0;
505 } else if (!strcmp(k, "push.gpgsign")) {
506 switch (git_parse_maybe_bool(v)) {
507 case 0:
508 set_push_cert_flags(flags, SEND_PACK_PUSH_CERT_NEVER);
509 break;
510 case 1:
511 set_push_cert_flags(flags, SEND_PACK_PUSH_CERT_ALWAYS);
512 break;
513 default:
514 if (!strcasecmp(v, "if-asked"))
515 set_push_cert_flags(flags, SEND_PACK_PUSH_CERT_IF_ASKED);
516 else
517 return error(_("invalid value for '%s'"), k);
518 }
519 } else if (!strcmp(k, "push.recursesubmodules")) {
520 recurse_submodules = parse_push_recurse_submodules_arg(k, v);
521 } else if (!strcmp(k, "submodule.recurse")) {
522 int val = git_config_bool(k, v) ?
523 RECURSE_SUBMODULES_ON_DEMAND : RECURSE_SUBMODULES_OFF;
524 recurse_submodules = val;
525 } else if (!strcmp(k, "push.pushoption")) {
526 return parse_transport_option(k, v, &push_options_config);
527 } else if (!strcmp(k, "color.push")) {
528 push_use_color = git_config_colorbool(k, v);
529 return 0;
530 } else if (skip_prefix(k, "color.push.", &slot_name)) {
531 int slot = parse_push_color_slot(slot_name);
532 if (slot < 0)
533 return 0;
534 if (!v)
535 return config_error_nonbool(k);
536 return color_parse(v, push_colors[slot]);
537 } else if (!strcmp(k, "push.useforceifincludes")) {
538 if (git_config_bool(k, v))
539 *flags |= TRANSPORT_PUSH_FORCE_IF_INCLUDES;
540 else
541 *flags &= ~TRANSPORT_PUSH_FORCE_IF_INCLUDES;
542 return 0;
543 }
544
545 return git_default_config(k, v, ctx, NULL);
546}

Callers

nothing calls this directly

Calls 11

git_config_boolFunction · 0.85
git_parse_maybe_boolFunction · 0.85
set_push_cert_flagsFunction · 0.85
errorFunction · 0.85
parse_transport_optionFunction · 0.85
git_config_colorboolFunction · 0.85
parse_push_color_slotFunction · 0.85
config_error_nonboolFunction · 0.85
color_parseFunction · 0.85
git_default_configFunction · 0.85

Tested by

no test coverage detected