8 #include "environment.h"
11 #include "run-command.h"
13 #include "transport.h"
14 #include "parse-options.h"
16 #include "repository.h"
17 #include "submodule.h"
18 #include "submodule-config.h"
19 #include "send-pack.h"
23 static const char * const push_usage
[] = {
24 N_("git push [<options>] [<repository> [<refspec>...]]"),
28 static int push_use_color
= -1;
29 static char push_colors
[][COLOR_MAXLEN
] = {
31 GIT_COLOR_RED
, /* ERROR */
39 static int parse_push_color_slot(const char *slot
)
41 if (!strcasecmp(slot
, "reset"))
42 return PUSH_COLOR_RESET
;
43 if (!strcasecmp(slot
, "error"))
44 return PUSH_COLOR_ERROR
;
48 static const char *push_get_color(enum color_push ix
)
50 if (want_color_stderr(push_use_color
))
51 return push_colors
[ix
];
56 static int deleterefs
;
57 static const char *receivepack
;
59 static int progress
= -1;
60 static int recurse_submodules
= RECURSE_SUBMODULES_DEFAULT
;
61 static enum transport_family family
;
63 static struct push_cas_option cas
;
65 static struct refspec rs
= REFSPEC_INIT_PUSH
;
67 static struct string_list push_options_config
= STRING_LIST_INIT_DUP
;
69 static void refspec_append_mapped(struct refspec
*refspec
, const char *ref
,
70 struct remote
*remote
, struct ref
*matched
)
72 const char *branch_name
;
74 if (remote
->push
.nr
) {
75 struct refspec_item query
;
76 memset(&query
, 0, sizeof(struct refspec_item
));
77 query
.src
= matched
->name
;
78 if (!query_refspecs(&remote
->push
, &query
) && query
.dst
) {
79 refspec_appendf(refspec
, "%s%s:%s",
80 query
.force
? "+" : "",
81 query
.src
, query
.dst
);
86 if (push_default
== PUSH_DEFAULT_UPSTREAM
&&
87 skip_prefix(matched
->name
, "refs/heads/", &branch_name
)) {
88 struct branch
*branch
= branch_get(branch_name
);
89 if (branch
->merge_nr
== 1 && branch
->merge
[0]->src
) {
90 refspec_appendf(refspec
, "%s:%s",
91 ref
, branch
->merge
[0]->src
);
96 refspec_append(refspec
, ref
);
99 static void set_refspecs(const char **refs
, int nr
, const char *repo
)
101 struct remote
*remote
= NULL
;
102 struct ref
*local_refs
= NULL
;
105 for (i
= 0; i
< nr
; i
++) {
106 const char *ref
= refs
[i
];
107 if (!strcmp("tag", ref
)) {
109 die(_("tag shorthand without <tag>"));
112 refspec_appendf(&rs
, ":refs/tags/%s", ref
);
114 refspec_appendf(&rs
, "refs/tags/%s", ref
);
115 } else if (deleterefs
) {
116 if (strchr(ref
, ':') || !*ref
)
117 die(_("--delete only accepts plain target ref names"));
118 refspec_appendf(&rs
, ":%s", ref
);
119 } else if (!strchr(ref
, ':')) {
120 struct ref
*matched
= NULL
;
122 /* lazily grab local_refs */
124 local_refs
= get_local_heads();
126 /* Does "ref" uniquely name our ref? */
127 if (count_refspec_match(ref
, local_refs
, &matched
) != 1) {
128 refspec_append(&rs
, ref
);
130 /* lazily grab remote */
132 remote
= remote_get(repo
);
134 BUG("must get a remote for repo '%s'", repo
);
136 refspec_append_mapped(&rs
, ref
, remote
, matched
);
139 refspec_append(&rs
, ref
);
141 free_refs(local_refs
);
144 static int push_url_of_remote(struct remote
*remote
, const char ***url_p
)
146 if (remote
->pushurl_nr
) {
147 *url_p
= remote
->pushurl
;
148 return remote
->pushurl_nr
;
150 *url_p
= remote
->url
;
151 return remote
->url_nr
;
154 static NORETURN
void die_push_simple(struct branch
*branch
,
155 struct remote
*remote
)
158 * There's no point in using shorten_unambiguous_ref here,
159 * as the ambiguity would be on the remote side, not what
160 * we have locally. Plus, this is supposed to be the simple
161 * mode. If the user is doing something crazy like setting
162 * upstream to a non-branch, we should probably be showing
163 * them the big ugly fully qualified ref.
165 const char *advice_pushdefault_maybe
= "";
166 const char *advice_automergesimple_maybe
= "";
167 const char *short_upstream
= branch
->merge
[0]->src
;
169 skip_prefix(short_upstream
, "refs/heads/", &short_upstream
);
172 * Don't show advice for people who explicitly set
175 if (push_default
== PUSH_DEFAULT_UNSPECIFIED
)
176 advice_pushdefault_maybe
= _("\n"
177 "To choose either option permanently, "
178 "see push.default in 'git help config'.\n");
179 if (git_branch_track
!= BRANCH_TRACK_SIMPLE
)
180 advice_automergesimple_maybe
= _("\n"
181 "To avoid automatically configuring "
182 "an upstream branch when its name\n"
183 "won't match the local branch, see option "
184 "'simple' of branch.autoSetupMerge\n"
185 "in 'git help config'.\n");
186 die(_("The upstream branch of your current branch does not match\n"
187 "the name of your current branch. To push to the upstream branch\n"
188 "on the remote, use\n"
190 " git push %s HEAD:%s\n"
192 "To push to the branch of the same name on the remote, use\n"
194 " git push %s HEAD\n"
196 remote
->name
, short_upstream
,
197 remote
->name
, advice_pushdefault_maybe
,
198 advice_automergesimple_maybe
);
201 static const char message_detached_head_die
[] =
202 N_("You are not currently on a branch.\n"
203 "To push the history leading to the current (detached HEAD)\n"
206 " git push %s HEAD:<name-of-remote-branch>\n");
208 static const char *get_upstream_ref(int flags
, struct branch
*branch
, const char *remote_name
)
210 if (branch
->merge_nr
== 0 && (flags
& TRANSPORT_PUSH_AUTO_UPSTREAM
)) {
211 /* if missing, assume same; set_upstream will be defined later */
212 return branch
->refname
;
215 if (!branch
->merge_nr
|| !branch
->merge
|| !branch
->remote_name
) {
216 const char *advice_autosetup_maybe
= "";
217 if (!(flags
& TRANSPORT_PUSH_AUTO_UPSTREAM
)) {
218 advice_autosetup_maybe
= _("\n"
219 "To have this happen automatically for "
220 "branches without a tracking\n"
221 "upstream, see 'push.autoSetupRemote' "
222 "in 'git help config'.\n");
224 die(_("The current branch %s has no upstream branch.\n"
225 "To push the current branch and set the remote as upstream, use\n"
227 " git push --set-upstream %s %s\n"
232 advice_autosetup_maybe
);
234 if (branch
->merge_nr
!= 1)
235 die(_("The current branch %s has multiple upstream branches, "
236 "refusing to push."), branch
->name
);
238 return branch
->merge
[0]->src
;
241 static void setup_default_push_refspecs(int *flags
, struct remote
*remote
)
243 struct branch
*branch
;
247 switch (push_default
) {
248 case PUSH_DEFAULT_MATCHING
:
249 refspec_append(&rs
, ":");
252 case PUSH_DEFAULT_NOTHING
:
253 die(_("You didn't specify any refspecs to push, and "
254 "push.default is \"nothing\"."));
260 branch
= branch_get(NULL
);
262 die(_(message_detached_head_die
), remote
->name
);
264 dst
= branch
->refname
;
265 same_remote
= !strcmp(remote
->name
, remote_for_branch(branch
, NULL
));
267 switch (push_default
) {
269 case PUSH_DEFAULT_UNSPECIFIED
:
270 case PUSH_DEFAULT_SIMPLE
:
273 if (strcmp(branch
->refname
, get_upstream_ref(*flags
, branch
, remote
->name
)))
274 die_push_simple(branch
, remote
);
277 case PUSH_DEFAULT_UPSTREAM
:
279 die(_("You are pushing to remote '%s', which is not the upstream of\n"
280 "your current branch '%s', without telling me what to push\n"
281 "to update which remote branch."),
282 remote
->name
, branch
->name
);
283 dst
= get_upstream_ref(*flags
, branch
, remote
->name
);
286 case PUSH_DEFAULT_CURRENT
:
291 * this is a default push - if auto-upstream is enabled and there is
292 * no upstream defined, then set it (with options 'simple', 'upstream',
295 if ((*flags
& TRANSPORT_PUSH_AUTO_UPSTREAM
) && branch
->merge_nr
== 0)
296 *flags
|= TRANSPORT_PUSH_SET_UPSTREAM
;
298 refspec_appendf(&rs
, "%s:%s", branch
->refname
, dst
);
301 static const char message_advice_pull_before_push
[] =
302 N_("Updates were rejected because the tip of your current branch is behind\n"
303 "its remote counterpart. If you want to integrate the remote changes,\n"
304 "use 'git pull' before pushing again.\n"
305 "See the 'Note about fast-forwards' in 'git push --help' for details.");
307 static const char message_advice_checkout_pull_push
[] =
308 N_("Updates were rejected because a pushed branch tip is behind its remote\n"
309 "counterpart. If you want to integrate the remote changes, use 'git pull'\n"
310 "before pushing again.\n"
311 "See the 'Note about fast-forwards' in 'git push --help' for details.");
313 static const char message_advice_ref_fetch_first
[] =
314 N_("Updates were rejected because the remote contains work that you do not\n"
315 "have locally. This is usually caused by another repository pushing to\n"
316 "the same ref. If you want to integrate the remote changes, use\n"
317 "'git pull' before pushing again.\n"
318 "See the 'Note about fast-forwards' in 'git push --help' for details.");
320 static const char message_advice_ref_already_exists
[] =
321 N_("Updates were rejected because the tag already exists in the remote.");
323 static const char message_advice_ref_needs_force
[] =
324 N_("You cannot update a remote ref that points at a non-commit object,\n"
325 "or update a remote ref to make it point at a non-commit object,\n"
326 "without using the '--force' option.\n");
328 static const char message_advice_ref_needs_update
[] =
329 N_("Updates were rejected because the tip of the remote-tracking branch has\n"
330 "been updated since the last checkout. If you want to integrate the\n"
331 "remote changes, use 'git pull' before pushing again.\n"
332 "See the 'Note about fast-forwards' in 'git push --help' for details.");
334 static void advise_pull_before_push(void)
336 if (!advice_enabled(ADVICE_PUSH_NON_FF_CURRENT
) || !advice_enabled(ADVICE_PUSH_UPDATE_REJECTED
))
338 advise(_(message_advice_pull_before_push
));
341 static void advise_checkout_pull_push(void)
343 if (!advice_enabled(ADVICE_PUSH_NON_FF_MATCHING
) || !advice_enabled(ADVICE_PUSH_UPDATE_REJECTED
))
345 advise(_(message_advice_checkout_pull_push
));
348 static void advise_ref_already_exists(void)
350 if (!advice_enabled(ADVICE_PUSH_ALREADY_EXISTS
) || !advice_enabled(ADVICE_PUSH_UPDATE_REJECTED
))
352 advise(_(message_advice_ref_already_exists
));
355 static void advise_ref_fetch_first(void)
357 if (!advice_enabled(ADVICE_PUSH_FETCH_FIRST
) || !advice_enabled(ADVICE_PUSH_UPDATE_REJECTED
))
359 advise(_(message_advice_ref_fetch_first
));
362 static void advise_ref_needs_force(void)
364 if (!advice_enabled(ADVICE_PUSH_NEEDS_FORCE
) || !advice_enabled(ADVICE_PUSH_UPDATE_REJECTED
))
366 advise(_(message_advice_ref_needs_force
));
369 static void advise_ref_needs_update(void)
371 if (!advice_enabled(ADVICE_PUSH_REF_NEEDS_UPDATE
) || !advice_enabled(ADVICE_PUSH_UPDATE_REJECTED
))
373 advise(_(message_advice_ref_needs_update
));
376 static int push_with_options(struct transport
*transport
, struct refspec
*rs
,
380 unsigned int reject_reasons
;
381 char *anon_url
= transport_anonymize_url(transport
->url
);
383 transport_set_verbosity(transport
, verbosity
, progress
);
384 transport
->family
= family
;
387 transport_set_option(transport
,
388 TRANS_OPT_RECEIVEPACK
, receivepack
);
389 transport_set_option(transport
, TRANS_OPT_THIN
, thin
? "yes" : NULL
);
391 if (!is_empty_cas(&cas
)) {
392 if (!transport
->smart_options
)
393 die("underlying transport does not support --%s option",
395 transport
->smart_options
->cas
= &cas
;
399 fprintf(stderr
, _("Pushing to %s\n"), anon_url
);
400 trace2_region_enter("push", "transport_push", the_repository
);
401 err
= transport_push(the_repository
, transport
,
402 rs
, flags
, &reject_reasons
);
403 trace2_region_leave("push", "transport_push", the_repository
);
405 fprintf(stderr
, "%s", push_get_color(PUSH_COLOR_ERROR
));
406 error(_("failed to push some refs to '%s'"), anon_url
);
407 fprintf(stderr
, "%s", push_get_color(PUSH_COLOR_RESET
));
410 err
|= transport_disconnect(transport
);
415 if (reject_reasons
& REJECT_NON_FF_HEAD
) {
416 advise_pull_before_push();
417 } else if (reject_reasons
& REJECT_NON_FF_OTHER
) {
418 advise_checkout_pull_push();
419 } else if (reject_reasons
& REJECT_ALREADY_EXISTS
) {
420 advise_ref_already_exists();
421 } else if (reject_reasons
& REJECT_FETCH_FIRST
) {
422 advise_ref_fetch_first();
423 } else if (reject_reasons
& REJECT_NEEDS_FORCE
) {
424 advise_ref_needs_force();
425 } else if (reject_reasons
& REJECT_REF_NEEDS_UPDATE
) {
426 advise_ref_needs_update();
432 static int do_push(int flags
,
433 const struct string_list
*push_options
,
434 struct remote
*remote
)
439 struct refspec
*push_refspec
= &rs
;
441 if (push_options
->nr
)
442 flags
|= TRANSPORT_PUSH_OPTIONS
;
444 if (!push_refspec
->nr
&& !(flags
& TRANSPORT_PUSH_ALL
)) {
445 if (remote
->push
.nr
) {
446 push_refspec
= &remote
->push
;
447 } else if (!(flags
& TRANSPORT_PUSH_MIRROR
))
448 setup_default_push_refspecs(&flags
, remote
);
451 url_nr
= push_url_of_remote(remote
, &url
);
453 for (i
= 0; i
< url_nr
; i
++) {
454 struct transport
*transport
=
455 transport_get(remote
, url
[i
]);
456 if (flags
& TRANSPORT_PUSH_OPTIONS
)
457 transport
->push_options
= push_options
;
458 if (push_with_options(transport
, push_refspec
, flags
))
462 struct transport
*transport
=
463 transport_get(remote
, NULL
);
464 if (flags
& TRANSPORT_PUSH_OPTIONS
)
465 transport
->push_options
= push_options
;
466 if (push_with_options(transport
, push_refspec
, flags
))
472 static int option_parse_recurse_submodules(const struct option
*opt
,
473 const char *arg
, int unset
)
475 int *recurse_submodules
= opt
->value
;
478 *recurse_submodules
= RECURSE_SUBMODULES_OFF
;
480 if (!strcmp(arg
, "only-is-on-demand")) {
481 if (*recurse_submodules
== RECURSE_SUBMODULES_ONLY
) {
482 warning(_("recursing into submodule with push.recurseSubmodules=only; using on-demand instead"));
483 *recurse_submodules
= RECURSE_SUBMODULES_ON_DEMAND
;
486 *recurse_submodules
= parse_push_recurse_submodules_arg(opt
->long_name
, arg
);
493 static void set_push_cert_flags(int *flags
, int v
)
496 case SEND_PACK_PUSH_CERT_NEVER
:
497 *flags
&= ~(TRANSPORT_PUSH_CERT_ALWAYS
| TRANSPORT_PUSH_CERT_IF_ASKED
);
499 case SEND_PACK_PUSH_CERT_ALWAYS
:
500 *flags
|= TRANSPORT_PUSH_CERT_ALWAYS
;
501 *flags
&= ~TRANSPORT_PUSH_CERT_IF_ASKED
;
503 case SEND_PACK_PUSH_CERT_IF_ASKED
:
504 *flags
|= TRANSPORT_PUSH_CERT_IF_ASKED
;
505 *flags
&= ~TRANSPORT_PUSH_CERT_ALWAYS
;
511 static int git_push_config(const char *k
, const char *v
,
512 const struct config_context
*ctx
, void *cb
)
514 const char *slot_name
;
517 if (!strcmp(k
, "push.followtags")) {
518 if (git_config_bool(k
, v
))
519 *flags
|= TRANSPORT_PUSH_FOLLOW_TAGS
;
521 *flags
&= ~TRANSPORT_PUSH_FOLLOW_TAGS
;
523 } else if (!strcmp(k
, "push.autosetupremote")) {
524 if (git_config_bool(k
, v
))
525 *flags
|= TRANSPORT_PUSH_AUTO_UPSTREAM
;
527 } else if (!strcmp(k
, "push.gpgsign")) {
528 switch (git_parse_maybe_bool(v
)) {
530 set_push_cert_flags(flags
, SEND_PACK_PUSH_CERT_NEVER
);
533 set_push_cert_flags(flags
, SEND_PACK_PUSH_CERT_ALWAYS
);
536 if (!strcasecmp(v
, "if-asked"))
537 set_push_cert_flags(flags
, SEND_PACK_PUSH_CERT_IF_ASKED
);
539 return error(_("invalid value for '%s'"), k
);
541 } else if (!strcmp(k
, "push.recursesubmodules")) {
542 recurse_submodules
= parse_push_recurse_submodules_arg(k
, v
);
543 } else if (!strcmp(k
, "submodule.recurse")) {
544 int val
= git_config_bool(k
, v
) ?
545 RECURSE_SUBMODULES_ON_DEMAND
: RECURSE_SUBMODULES_OFF
;
546 recurse_submodules
= val
;
547 } else if (!strcmp(k
, "push.pushoption")) {
549 return config_error_nonbool(k
);
552 string_list_clear(&push_options_config
, 0);
554 string_list_append(&push_options_config
, v
);
556 } else if (!strcmp(k
, "color.push")) {
557 push_use_color
= git_config_colorbool(k
, v
);
559 } else if (skip_prefix(k
, "color.push.", &slot_name
)) {
560 int slot
= parse_push_color_slot(slot_name
);
564 return config_error_nonbool(k
);
565 return color_parse(v
, push_colors
[slot
]);
566 } else if (!strcmp(k
, "push.useforceifincludes")) {
567 if (git_config_bool(k
, v
))
568 *flags
|= TRANSPORT_PUSH_FORCE_IF_INCLUDES
;
570 *flags
&= ~TRANSPORT_PUSH_FORCE_IF_INCLUDES
;
574 return git_default_config(k
, v
, ctx
, NULL
);
577 int cmd_push(int argc
, const char **argv
, const char *prefix
)
583 const char *repo
= NULL
; /* default repository */
584 struct string_list push_options_cmdline
= STRING_LIST_INIT_DUP
;
585 struct string_list
*push_options
;
586 const struct string_list_item
*item
;
587 struct remote
*remote
;
589 struct option options
[] = {
590 OPT__VERBOSITY(&verbosity
),
591 OPT_STRING( 0 , "repo", &repo
, N_("repository"), N_("repository")),
592 OPT_BIT( 0 , "all", &flags
, N_("push all branches"), TRANSPORT_PUSH_ALL
),
593 OPT_ALIAS( 0 , "branches", "all"),
594 OPT_BIT( 0 , "mirror", &flags
, N_("mirror all refs"),
595 (TRANSPORT_PUSH_MIRROR
|TRANSPORT_PUSH_FORCE
)),
596 OPT_BOOL('d', "delete", &deleterefs
, N_("delete refs")),
597 OPT_BOOL( 0 , "tags", &tags
, N_("push tags (can't be used with --all or --branches or --mirror)")),
598 OPT_BIT('n' , "dry-run", &flags
, N_("dry run"), TRANSPORT_PUSH_DRY_RUN
),
599 OPT_BIT( 0, "porcelain", &flags
, N_("machine-readable output"), TRANSPORT_PUSH_PORCELAIN
),
600 OPT_BIT('f', "force", &flags
, N_("force updates"), TRANSPORT_PUSH_FORCE
),
601 OPT_CALLBACK_F(0, "force-with-lease", &cas
, N_("<refname>:<expect>"),
602 N_("require old value of ref to be at this value"),
603 PARSE_OPT_OPTARG
| PARSE_OPT_LITERAL_ARGHELP
, parseopt_push_cas_option
),
604 OPT_BIT(0, TRANS_OPT_FORCE_IF_INCLUDES
, &flags
,
605 N_("require remote updates to be integrated locally"),
606 TRANSPORT_PUSH_FORCE_IF_INCLUDES
),
607 OPT_CALLBACK(0, "recurse-submodules", &recurse_submodules
, "(check|on-demand|no)",
608 N_("control recursive pushing of submodules"), option_parse_recurse_submodules
),
609 OPT_BOOL_F( 0 , "thin", &thin
, N_("use thin pack"), PARSE_OPT_NOCOMPLETE
),
610 OPT_STRING( 0 , "receive-pack", &receivepack
, "receive-pack", N_("receive pack program")),
611 OPT_STRING( 0 , "exec", &receivepack
, "receive-pack", N_("receive pack program")),
612 OPT_BIT('u', "set-upstream", &flags
, N_("set upstream for git pull/status"),
613 TRANSPORT_PUSH_SET_UPSTREAM
),
614 OPT_BOOL(0, "progress", &progress
, N_("force progress reporting")),
615 OPT_BIT(0, "prune", &flags
, N_("prune locally removed refs"),
616 TRANSPORT_PUSH_PRUNE
),
617 OPT_BIT(0, "no-verify", &flags
, N_("bypass pre-push hook"), TRANSPORT_PUSH_NO_HOOK
),
618 OPT_BIT(0, "follow-tags", &flags
, N_("push missing but relevant tags"),
619 TRANSPORT_PUSH_FOLLOW_TAGS
),
620 OPT_CALLBACK_F(0, "signed", &push_cert
, "(yes|no|if-asked)", N_("GPG sign the push"),
621 PARSE_OPT_OPTARG
, option_parse_push_signed
),
622 OPT_BIT(0, "atomic", &flags
, N_("request atomic transaction on remote side"), TRANSPORT_PUSH_ATOMIC
),
623 OPT_STRING_LIST('o', "push-option", &push_options_cmdline
, N_("server-specific"), N_("option to transmit")),
624 OPT_IPVERSION(&family
),
628 packet_trace_identity("push");
629 git_config(git_push_config
, &flags
);
630 argc
= parse_options(argc
, argv
, prefix
, options
, push_usage
, 0);
631 push_options
= (push_options_cmdline
.nr
632 ? &push_options_cmdline
633 : &push_options_config
);
634 set_push_cert_flags(&flags
, push_cert
);
636 die_for_incompatible_opt4(deleterefs
, "--delete",
638 flags
& TRANSPORT_PUSH_ALL
, "--all/--branches",
639 flags
& TRANSPORT_PUSH_MIRROR
, "--mirror");
640 if (deleterefs
&& argc
< 2)
641 die(_("--delete doesn't make sense without any refs"));
643 if (recurse_submodules
== RECURSE_SUBMODULES_CHECK
)
644 flags
|= TRANSPORT_RECURSE_SUBMODULES_CHECK
;
645 else if (recurse_submodules
== RECURSE_SUBMODULES_ON_DEMAND
)
646 flags
|= TRANSPORT_RECURSE_SUBMODULES_ON_DEMAND
;
647 else if (recurse_submodules
== RECURSE_SUBMODULES_ONLY
)
648 flags
|= TRANSPORT_RECURSE_SUBMODULES_ONLY
;
651 refspec_append(&rs
, "refs/tags/*");
655 set_refspecs(argv
+ 1, argc
- 1, repo
);
658 remote
= pushremote_get(repo
);
661 die(_("bad repository '%s'"), repo
);
662 die(_("No configured push destination.\n"
663 "Either specify the URL from the command-line or configure a remote repository using\n"
665 " git remote add <name> <url>\n"
667 "and then push using the remote name\n"
669 " git push <name>\n"));
673 flags
|= (TRANSPORT_PUSH_MIRROR
|TRANSPORT_PUSH_FORCE
);
675 if (flags
& TRANSPORT_PUSH_ALL
) {
677 die(_("--all can't be combined with refspecs"));
679 if (flags
& TRANSPORT_PUSH_MIRROR
) {
681 die(_("--mirror can't be combined with refspecs"));
684 if (!is_empty_cas(&cas
) && (flags
& TRANSPORT_PUSH_FORCE_IF_INCLUDES
))
685 cas
.use_force_if_includes
= 1;
687 for_each_string_list_item(item
, push_options
)
688 if (strchr(item
->string
, '\n'))
689 die(_("push options must not have new line characters"));
691 rc
= do_push(flags
, push_options
, remote
);
692 string_list_clear(&push_options_cmdline
, 0);
693 string_list_clear(&push_options_config
, 0);
695 usage_with_options(push_usage
, options
);