@@ -1544,6 +1544,9 @@ static struct option *add_checkout_path_options(struct checkout_opts *opts,
1544
1544
return newopts ;
1545
1545
}
1546
1546
1547
+ /* create-branch option (either b or c) */
1548
+ static char cb_option = 'b' ;
1549
+
1547
1550
static int checkout_main (int argc , const char * * argv , const char * prefix ,
1548
1551
struct checkout_opts * opts , struct option * options ,
1549
1552
const char * const usagestr [])
@@ -1586,7 +1589,8 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
1586
1589
}
1587
1590
1588
1591
if ((!!opts -> new_branch + !!opts -> new_branch_force + !!opts -> new_orphan_branch ) > 1 )
1589
- die (_ ("-b, -B and --orphan are mutually exclusive" ));
1592
+ die (_ ("-%c, -%c and --orphan are mutually exclusive" ),
1593
+ cb_option , toupper (cb_option ));
1590
1594
1591
1595
if (opts -> overlay_mode == 1 && opts -> patch_mode )
1592
1596
die (_ ("-p and --overlay are mutually exclusive" ));
@@ -1614,15 +1618,15 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
1614
1618
/*
1615
1619
* From here on, new_branch will contain the branch to be checked out,
1616
1620
* and new_branch_force and new_orphan_branch will tell us which one of
1617
- * -b/-B/--orphan is being used.
1621
+ * -b/-B/-c/-C/- -orphan is being used.
1618
1622
*/
1619
1623
if (opts -> new_branch_force )
1620
1624
opts -> new_branch = opts -> new_branch_force ;
1621
1625
1622
1626
if (opts -> new_orphan_branch )
1623
1627
opts -> new_branch = opts -> new_orphan_branch ;
1624
1628
1625
- /* --track without -b/-B/--orphan should DWIM */
1629
+ /* --track without -c/-C/- b/-B/--orphan should DWIM */
1626
1630
if (opts -> track != BRANCH_TRACK_UNSPECIFIED && !opts -> new_branch ) {
1627
1631
const char * argv0 = argv [0 ];
1628
1632
if (!argc || !strcmp (argv0 , "--" ))
@@ -1631,7 +1635,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
1631
1635
skip_prefix (argv0 , "remotes/" , & argv0 );
1632
1636
argv0 = strchr (argv0 , '/' );
1633
1637
if (!argv0 || !argv0 [1 ])
1634
- die (_ ("missing branch name; try -b" ) );
1638
+ die (_ ("missing branch name; try -%c" ), cb_option );
1635
1639
opts -> new_branch = argv0 + 1 ;
1636
1640
}
1637
1641
@@ -1822,6 +1826,8 @@ int cmd_switch(int argc, const char **argv, const char *prefix)
1822
1826
options = add_common_options (& opts , options );
1823
1827
options = add_common_switch_branch_options (& opts , options );
1824
1828
1829
+ cb_option = 'c' ;
1830
+
1825
1831
ret = checkout_main (argc , argv , prefix , & opts ,
1826
1832
options , switch_branch_usage );
1827
1833
FREE_AND_NULL (options );
0 commit comments