@@ -44,6 +44,7 @@ static int deepen;
4444static char * option_template , * option_depth , * option_since ;
4545static char * option_origin = NULL ;
4646static char * option_branch = NULL ;
47+ static struct string_list option_not = STRING_LIST_INIT_NODUP ;
4748static const char * real_git_dir ;
4849static char * option_upload_pack = "git-upload-pack" ;
4950static int option_verbosity ;
@@ -89,6 +90,8 @@ static struct option builtin_clone_options[] = {
8990 N_ ("create a shallow clone of that depth" )),
9091 OPT_STRING (0 , "shallow-since" , & option_since , N_ ("time" ),
9192 N_ ("create a shallow clone since a specific time" )),
93+ OPT_STRING_LIST (0 , "shallow-exclude" , & option_not , N_ ("revision" ),
94+ N_ ("deepen history of shallow clone by excluding rev" )),
9295 OPT_BOOL (0 , "single-branch" , & option_single_branch ,
9396 N_ ("clone only one branch, HEAD or --branch" )),
9497 OPT_STRING (0 , "separate-git-dir" , & real_git_dir , N_ ("gitdir" ),
@@ -852,7 +855,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
852855 usage_msg_opt (_ ("You must specify a repository to clone." ),
853856 builtin_clone_usage , builtin_clone_options );
854857
855- if (option_depth || option_since )
858+ if (option_depth || option_since || option_not . nr )
856859 deepen = 1 ;
857860 if (option_single_branch == -1 )
858861 option_single_branch = deepen ? 1 : 0 ;
@@ -983,6 +986,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
983986 warning (_ ("--depth is ignored in local clones; use file:// instead." ));
984987 if (option_since )
985988 warning (_ ("--shallow-since is ignored in local clones; use file:// instead." ));
989+ if (option_not .nr )
990+ warning (_ ("--shallow-exclude is ignored in local clones; use file:// instead." ));
986991 if (!access (mkpath ("%s/shallow" , path ), F_OK )) {
987992 if (option_local > 0 )
988993 warning (_ ("source repository is shallow, ignoring --local" ));
@@ -1004,6 +1009,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
10041009 if (option_since )
10051010 transport_set_option (transport , TRANS_OPT_DEEPEN_SINCE ,
10061011 option_since );
1012+ if (option_not .nr )
1013+ transport_set_option (transport , TRANS_OPT_DEEPEN_NOT ,
1014+ (const char * )& option_not );
10071015 if (option_single_branch )
10081016 transport_set_option (transport , TRANS_OPT_FOLLOWTAGS , "1" );
10091017
0 commit comments