1487
return newopts;
1488
}
1489
1490
+/* create-branch option (either b or c) */
1491
+static char cb_option = 'b';
1492
+
1493
static int checkout_main(int argc, const char **argv, const char *prefix,
1494
struct checkout_opts *opts, struct option *options,
1495
const char * const usagestr[])
1533
}
1534
1535
if ((!!opts->new_branch + !!opts->new_branch_force + !!opts->new_orphan_branch) > 1)
1533
- die(_("-b, -B and --orphan are mutually exclusive"));
1536
+ die(_("-%c, -%c and --orphan are mutually exclusive"),
1537
+ cb_option, toupper(cb_option));
1538
1539
if (opts->overlay_mode == 1 && opts->patch_mode)
1540
die(_("-p and --overlay are mutually exclusive"));
1562
/*
1563
* From here on, new_branch will contain the branch to be checked out,
1564
* and new_branch_force and new_orphan_branch will tell us which one of
1561
- * -b/-B/--orphan is being used.
1565
+ * -b/-B/-c/-C/--orphan is being used.
1566
*/
1567
if (opts->new_branch_force)
1568
opts->new_branch = opts->new_branch_force;
1570
if (opts->new_orphan_branch)
1571
opts->new_branch = opts->new_orphan_branch;
1572
1569
- /* --track without -b/-B/--orphan should DWIM */
1573
+ /* --track without -c/-C/-b/-B/--orphan should DWIM */
1574
if (opts->track != BRANCH_TRACK_UNSPECIFIED && !opts->new_branch) {
1575
const char *argv0 = argv[0];
1576
if (!argc || !strcmp(argv0, "--"))
1579
skip_prefix(argv0, "remotes/", &argv0);
1580
argv0 = strchr(argv0, '/');
1581
if (!argv0 || !argv0[1])
1578
- die(_("missing branch name; try -b"));
1582
+ die(_("missing branch name; try -%c"), cb_option);
1583
opts->new_branch = argv0 + 1;
1584
}
1585
1770
options = add_common_options(&opts, options);
1771
options = add_common_switch_branch_options(&opts, options);
1772
1773
+ cb_option = 'c';
1774
+
1775
ret = checkout_main(argc, argv, prefix, &opts,
1776
options, switch_branch_usage);
1777
FREE_AND_NULL(options);