@@ -410,7 +410,7 @@ static int cmd_clone(int argc, const char **argv)
410410{
411411 const char * branch = NULL ;
412412 int full_clone = 0 , single_branch = 0 , show_progress = isatty (2 );
413- int src = 1 ;
413+ int src = 1 , tags = 1 ;
414414 struct option clone_options [] = {
415415 OPT_STRING ('b' , "branch" , & branch , N_ ("<branch>" ),
416416 N_ ("branch to checkout after clone" )),
@@ -421,11 +421,13 @@ static int cmd_clone(int argc, const char **argv)
421421 "be checked out" )),
422422 OPT_BOOL (0 , "src" , & src ,
423423 N_ ("create repository within 'src' directory" )),
424+ OPT_BOOL (0 , "tags" , & tags ,
425+ N_ ("specify if tags should be fetched during clone" )),
424426 OPT_END (),
425427 };
426428 const char * const clone_usage [] = {
427429 N_ ("scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]\n"
428- "\t[--[no-]src] <url> [<enlistment>]" ),
430+ "\t[--[no-]src] [--[no-]tags] <url> [<enlistment>]" ),
429431 NULL
430432 };
431433 const char * url ;
@@ -504,6 +506,11 @@ static int cmd_clone(int argc, const char **argv)
504506 goto cleanup ;
505507 }
506508
509+ if (!tags && set_config ("remote.origin.tagOpt=--no-tags" )) {
510+ res = error (_ ("could not disable tags in '%s'" ), dir );
511+ goto cleanup ;
512+ }
513+
507514 if (!full_clone &&
508515 (res = run_git ("sparse-checkout" , "init" , "--cone" , NULL )))
509516 goto cleanup ;
@@ -513,7 +520,9 @@ static int cmd_clone(int argc, const char **argv)
513520
514521 if ((res = run_git ("fetch" , "--quiet" ,
515522 show_progress ? "--progress" : "--no-progress" ,
516- "origin" , NULL ))) {
523+ "origin" ,
524+ (tags ? NULL : "--no-tags" ),
525+ NULL ))) {
517526 warning (_ ("partial clone failed; attempting full clone" ));
518527
519528 if (set_config ("remote.origin.promisor" ) ||
0 commit comments