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

Function cmd_push

builtin/push.c:665–858  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

663}
664
665int cmd_push(int argc,
666 const char **argv,
667 const char *prefix,
668 struct repository *repository UNUSED)
669{
670 int flags = 0;
671 int tags = 0;
672 int push_cert = -1;
673 int rc = 0;
674 int base_flags;
675 const char *repo = NULL; /* default repository */
676 struct string_list push_options_cmdline = STRING_LIST_INIT_DUP;
677 struct string_list remote_group = STRING_LIST_INIT_DUP;
678 struct string_list *push_options;
679 const struct string_list_item *item;
680
681 struct option options[] = {
682 OPT__VERBOSITY(&verbosity),
683 OPT_STRING( 0 , "repo", &repo, N_("repository"), N_("repository")),
684 OPT_BIT( 0 , "all", &flags, N_("push all branches"), TRANSPORT_PUSH_ALL),
685 OPT_ALIAS( 0 , "branches", "all"),
686 OPT_BIT( 0 , "mirror", &flags, N_("mirror all refs"),
687 (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE)),
688 OPT_BOOL('d', "delete", &deleterefs, N_("delete refs")),
689 OPT_BOOL( 0 , "tags", &tags, N_("push tags (can't be used with --all or --branches or --mirror)")),
690 OPT_BIT('n' , "dry-run", &flags, N_("dry run"), TRANSPORT_PUSH_DRY_RUN),
691 OPT_BIT( 0, "porcelain", &flags, N_("machine-readable output"), TRANSPORT_PUSH_PORCELAIN),
692 OPT_BIT('f', "force", &flags, N_("force updates"), TRANSPORT_PUSH_FORCE),
693 OPT_CALLBACK_F(0, "force-with-lease", &cas, N_("<refname>:<expect>"),
694 N_("require old value of ref to be at this value"),
695 PARSE_OPT_OPTARG | PARSE_OPT_LITERAL_ARGHELP, parseopt_push_cas_option),
696 OPT_BIT(0, TRANS_OPT_FORCE_IF_INCLUDES, &flags,
697 N_("require remote updates to be integrated locally"),
698 TRANSPORT_PUSH_FORCE_IF_INCLUDES),
699 OPT_CALLBACK(0, "recurse-submodules", &recurse_submodules, "(check|on-demand|no)",
700 N_("control recursive pushing of submodules"), option_parse_recurse_submodules),
701 OPT_BOOL_F( 0 , "thin", &thin, N_("use thin pack"), PARSE_OPT_NOCOMPLETE),
702 OPT_STRING( 0 , "receive-pack", &receivepack, "receive-pack", N_("receive pack program")),
703 OPT_STRING( 0 , "exec", &receivepack, "receive-pack", N_("receive pack program")),
704 OPT_BIT('u', "set-upstream", &flags, N_("set upstream for git pull/status"),
705 TRANSPORT_PUSH_SET_UPSTREAM),
706 OPT_BOOL(0, "progress", &progress, N_("force progress reporting")),
707 OPT_BIT(0, "prune", &flags, N_("prune locally removed refs"),
708 TRANSPORT_PUSH_PRUNE),
709 OPT_BIT(0, "no-verify", &flags, N_("bypass pre-push hook"), TRANSPORT_PUSH_NO_HOOK),
710 OPT_BIT(0, "follow-tags", &flags, N_("push missing but relevant tags"),
711 TRANSPORT_PUSH_FOLLOW_TAGS),
712 OPT_CALLBACK_F(0, "signed", &push_cert, "(yes|no|if-asked)", N_("GPG sign the push"),
713 PARSE_OPT_OPTARG, option_parse_push_signed),
714 OPT_BIT(0, "atomic", &flags, N_("request atomic transaction on remote side"), TRANSPORT_PUSH_ATOMIC),
715 OPT_STRING_LIST('o', "push-option", &push_options_cmdline, N_("server-specific"), N_("option to transmit")),
716 OPT_IPVERSION(&family),
717 OPT_END()
718 };
719
720 packet_trace_identity("push");
721 repo_config(the_repository, git_push_config, &flags);
722 argc = parse_options(argc, argv, prefix, options, push_usage, 0);

Callers

nothing calls this directly

Calls 15

packet_trace_identityFunction · 0.85
parse_optionsFunction · 0.85
set_push_cert_flagsFunction · 0.85
add_remote_or_groupFunction · 0.85
pushremote_getFunction · 0.85
is_empty_casFunction · 0.85
refspec_clearFunction · 0.85
refspec_appendFunction · 0.85
set_refspecsFunction · 0.85
do_pushFunction · 0.85
push_multipleFunction · 0.85

Tested by

no test coverage detected