@@ -405,7 +405,7 @@ void load_builtin_commands(const char *prefix, struct cmdnames *cmds)
405405static int cmd_clone (int argc , const char * * argv )
406406{
407407 const char * branch = NULL ;
408- int full_clone = 0 , single_branch = 0 ;
408+ int full_clone = 0 , single_branch = 0 , show_progress = isatty ( 2 ) ;
409409 struct option clone_options [] = {
410410 OPT_STRING ('b' , "branch" , & branch , N_ ("<branch>" ),
411411 N_ ("branch to checkout after clone" )),
@@ -500,7 +500,9 @@ static int cmd_clone(int argc, const char **argv)
500500 if (set_recommended_config (0 ))
501501 return error (_ ("could not configure '%s'" ), dir );
502502
503- if ((res = run_git ("fetch" , "--quiet" , "origin" , NULL ))) {
503+ if ((res = run_git ("fetch" , "--quiet" ,
504+ show_progress ? "--progress" : "--no-progress" ,
505+ "origin" , NULL ))) {
504506 warning (_ ("partial clone failed; attempting full clone" ));
505507
506508 if (set_config ("remote.origin.promisor" ) ||
@@ -509,7 +511,9 @@ static int cmd_clone(int argc, const char **argv)
509511 goto cleanup ;
510512 }
511513
512- if ((res = run_git ("fetch" , "--quiet" , "origin" , NULL )))
514+ if ((res = run_git ("fetch" , "--quiet" ,
515+ show_progress ? "--progress" : "--no-progress" ,
516+ "origin" , NULL )))
513517 goto cleanup ;
514518 }
515519
0 commit comments