@@ -37,6 +37,7 @@ struct checkout_opts {
37
37
int overwrite_ignore ;
38
38
int ignore_skipworktree ;
39
39
int ignore_other_worktrees ;
40
+ int show_progress ;
40
41
41
42
const char * new_branch ;
42
43
const char * new_branch_force ;
@@ -417,7 +418,7 @@ static int reset_tree(struct tree *tree, const struct checkout_opts *o,
417
418
opts .reset = 1 ;
418
419
opts .merge = 1 ;
419
420
opts .fn = oneway_merge ;
420
- opts .verbose_update = ! o -> quiet && isatty ( 2 ) ;
421
+ opts .verbose_update = o -> show_progress ;
421
422
opts .src_index = & the_index ;
422
423
opts .dst_index = & the_index ;
423
424
parse_tree (tree );
@@ -501,7 +502,7 @@ static int merge_working_tree(const struct checkout_opts *opts,
501
502
topts .update = 1 ;
502
503
topts .merge = 1 ;
503
504
topts .gently = opts -> merge && old -> commit ;
504
- topts .verbose_update = ! opts -> quiet && isatty ( 2 ) ;
505
+ topts .verbose_update = opts -> show_progress ;
505
506
topts .fn = twoway_merge ;
506
507
if (opts -> overwrite_ignore ) {
507
508
topts .dir = xcalloc (1 , sizeof (* topts .dir ));
@@ -1156,13 +1157,15 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
1156
1157
N_ ("second guess 'git checkout <no-such-branch>'" )),
1157
1158
OPT_BOOL (0 , "ignore-other-worktrees" , & opts .ignore_other_worktrees ,
1158
1159
N_ ("do not check if another worktree is holding the given ref" )),
1160
+ OPT_BOOL (0 , "progress" , & opts .show_progress , N_ ("force progress reporting" )),
1159
1161
OPT_END (),
1160
1162
};
1161
1163
1162
1164
memset (& opts , 0 , sizeof (opts ));
1163
1165
memset (& new , 0 , sizeof (new ));
1164
1166
opts .overwrite_ignore = 1 ;
1165
1167
opts .prefix = prefix ;
1168
+ opts .show_progress = -1 ;
1166
1169
1167
1170
gitmodules_config ();
1168
1171
git_config (git_checkout_config , & opts );
@@ -1172,6 +1175,13 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
1172
1175
argc = parse_options (argc , argv , prefix , options , checkout_usage ,
1173
1176
PARSE_OPT_KEEP_DASHDASH );
1174
1177
1178
+ if (opts .show_progress < 0 ) {
1179
+ if (opts .quiet )
1180
+ opts .show_progress = 0 ;
1181
+ else
1182
+ opts .show_progress = isatty (2 );
1183
+ }
1184
+
1175
1185
if (conflict_style ) {
1176
1186
opts .merge = 1 ; /* implied */
1177
1187
git_xmerge_config ("merge.conflictstyle" , conflict_style , NULL );
0 commit comments