@@ -47,6 +47,8 @@ struct checkout_opts {
4747 int show_progress ;
4848 int count_checkout_paths ;
4949 int overlay_mode ;
50+ int no_dwim_new_local_branch ;
51+
5052 /*
5153 * If new checkout options are added, skip_merge_working_tree
5254 * should be updated accordingly.
@@ -58,6 +60,7 @@ struct checkout_opts {
5860 int new_branch_log ;
5961 enum branch_track track ;
6062 struct diff_options diff_options ;
63+ char * conflict_style ;
6164
6265 int branch_exists ;
6366 const char * prefix ;
@@ -1344,8 +1347,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
13441347 struct checkout_opts real_opts ;
13451348 struct checkout_opts * opts = & real_opts ;
13461349 struct branch_info new_branch_info ;
1347- char * conflict_style = NULL ;
1348- int dwim_new_local_branch , no_dwim_new_local_branch = 0 ;
1350+ int dwim_new_local_branch ;
13491351 int dwim_remotes_matched = 0 ;
13501352 struct option options [] = {
13511353 OPT__QUIET (& opts -> quiet , N_ ("suppress progress reporting" )),
@@ -1370,12 +1372,12 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
13701372 OPT_BOOL_F (0 , "overwrite-ignore" , & opts -> overwrite_ignore ,
13711373 N_ ("update ignored files (default)" ),
13721374 PARSE_OPT_NOCOMPLETE ),
1373- OPT_STRING (0 , "conflict" , & conflict_style , N_ ("style" ),
1375+ OPT_STRING (0 , "conflict" , & opts -> conflict_style , N_ ("style" ),
13741376 N_ ("conflict style (merge or diff3)" )),
13751377 OPT_BOOL ('p' , "patch" , & opts -> patch_mode , N_ ("select hunks interactively" )),
13761378 OPT_BOOL (0 , "ignore-skip-worktree-bits" , & opts -> ignore_skipworktree ,
13771379 N_ ("do not limit pathspecs to sparse entries only" )),
1378- OPT_BOOL (0 , "no-guess" , & no_dwim_new_local_branch ,
1380+ OPT_BOOL (0 , "no-guess" , & opts -> no_dwim_new_local_branch ,
13791381 N_ ("do not second guess 'git checkout <no-such-branch>'" )),
13801382 OPT_BOOL (0 , "ignore-other-worktrees" , & opts -> ignore_other_worktrees ,
13811383 N_ ("do not check if another worktree is holding the given ref" )),
@@ -1393,6 +1395,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
13931395 opts -> prefix = prefix ;
13941396 opts -> show_progress = -1 ;
13951397 opts -> overlay_mode = -1 ;
1398+ opts -> no_dwim_new_local_branch = 0 ;
13961399
13971400 git_config (git_checkout_config , opts );
13981401
@@ -1401,17 +1404,17 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
14011404 argc = parse_options (argc , argv , prefix , options , checkout_usage ,
14021405 PARSE_OPT_KEEP_DASHDASH );
14031406
1404- dwim_new_local_branch = !no_dwim_new_local_branch ;
1407+ dwim_new_local_branch = !opts -> no_dwim_new_local_branch ;
14051408 if (opts -> show_progress < 0 ) {
14061409 if (opts -> quiet )
14071410 opts -> show_progress = 0 ;
14081411 else
14091412 opts -> show_progress = isatty (2 );
14101413 }
14111414
1412- if (conflict_style ) {
1415+ if (opts -> conflict_style ) {
14131416 opts -> merge = 1 ; /* implied */
1414- git_xmerge_config ("merge.conflictstyle" , conflict_style , NULL );
1417+ git_xmerge_config ("merge.conflictstyle" , opts -> conflict_style , NULL );
14151418 }
14161419
14171420 if ((!!opts -> new_branch + !!opts -> new_branch_force + !!opts -> new_orphan_branch ) > 1 )
0 commit comments