@@ -1274,9 +1274,9 @@ static int checkout_branch(struct checkout_opts *opts,
1274
1274
die (_ ("'%s' cannot be used with switching branches" ),
1275
1275
"--patch" );
1276
1276
1277
- if (! opts -> overlay_mode )
1277
+ if (opts -> overlay_mode != -1 )
1278
1278
die (_ ("'%s' cannot be used with switching branches" ),
1279
- "--no -overlay" );
1279
+ "--[no] -overlay" );
1280
1280
1281
1281
if (opts -> writeout_stage )
1282
1282
die (_ ("'%s' cannot be used with switching branches" ),
@@ -1399,7 +1399,6 @@ static struct option *add_checkout_path_options(struct checkout_opts *opts,
1399
1399
OPT_BOOL ('p' , "patch" , & opts -> patch_mode , N_ ("select hunks interactively" )),
1400
1400
OPT_BOOL (0 , "ignore-skip-worktree-bits" , & opts -> ignore_skipworktree ,
1401
1401
N_ ("do not limit pathspecs to sparse entries only" )),
1402
- OPT_BOOL (0 , "overlay" , & opts -> overlay_mode , N_ ("use overlay mode (default)" )),
1403
1402
OPT_END ()
1404
1403
};
1405
1404
struct option * newopts = parse_options_concat (prevopts , options );
@@ -1419,7 +1418,6 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
1419
1418
opts -> overwrite_ignore = 1 ;
1420
1419
opts -> prefix = prefix ;
1421
1420
opts -> show_progress = -1 ;
1422
- opts -> overlay_mode = -1 ;
1423
1421
1424
1422
git_config (git_checkout_config , opts );
1425
1423
@@ -1593,6 +1591,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
1593
1591
OPT_BOOL ('l' , NULL , & opts .new_branch_log , N_ ("create reflog for new branch" )),
1594
1592
OPT_BOOL (0 , "guess" , & opts .dwim_new_local_branch ,
1595
1593
N_ ("second guess 'git checkout <no-such-branch>' (default)" )),
1594
+ OPT_BOOL (0 , "overlay" , & opts .overlay_mode , N_ ("use overlay mode (default)" )),
1596
1595
OPT_END ()
1597
1596
};
1598
1597
int ret ;
@@ -1607,6 +1606,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
1607
1606
opts .can_switch_when_in_progress = 1 ;
1608
1607
opts .orphan_from_empty_tree = 0 ;
1609
1608
opts .empty_pathspec_ok = 1 ;
1609
+ opts .overlay_mode = -1 ;
1610
1610
1611
1611
options = parse_options_dup (checkout_options );
1612
1612
options = add_common_options (& opts , options );
@@ -1645,6 +1645,7 @@ int cmd_switch(int argc, const char **argv, const char *prefix)
1645
1645
opts .implicit_detach = 0 ;
1646
1646
opts .can_switch_when_in_progress = 0 ;
1647
1647
opts .orphan_from_empty_tree = 1 ;
1648
+ opts .overlay_mode = -1 ;
1648
1649
1649
1650
options = parse_options_dup (switch_options );
1650
1651
options = add_common_options (& opts , options );
@@ -1663,6 +1664,7 @@ int cmd_restore(int argc, const char **argv, const char *prefix)
1663
1664
struct option restore_options [] = {
1664
1665
OPT_STRING ('s' , "source" , & opts .from_treeish , "<tree-ish>" ,
1665
1666
N_ ("where the checkout from" )),
1667
+ OPT_BOOL (0 , "overlay" , & opts .overlay_mode , N_ ("use overlay mode" )),
1666
1668
OPT_END ()
1667
1669
};
1668
1670
int ret ;
@@ -1671,6 +1673,7 @@ int cmd_restore(int argc, const char **argv, const char *prefix)
1671
1673
opts .accept_ref = 0 ;
1672
1674
opts .accept_pathspec = 1 ;
1673
1675
opts .empty_pathspec_ok = 0 ;
1676
+ opts .overlay_mode = 0 ;
1674
1677
1675
1678
options = parse_options_dup (restore_options );
1676
1679
options = add_common_options (& opts , options );
0 commit comments