@@ -44,6 +44,7 @@ static int deepen;
44
44
static char * option_template , * option_depth , * option_since ;
45
45
static char * option_origin = NULL ;
46
46
static char * option_branch = NULL ;
47
+ static struct string_list option_not = STRING_LIST_INIT_NODUP ;
47
48
static const char * real_git_dir ;
48
49
static char * option_upload_pack = "git-upload-pack" ;
49
50
static int option_verbosity ;
@@ -89,6 +90,8 @@ static struct option builtin_clone_options[] = {
89
90
N_ ("create a shallow clone of that depth" )),
90
91
OPT_STRING (0 , "shallow-since" , & option_since , N_ ("time" ),
91
92
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" )),
92
95
OPT_BOOL (0 , "single-branch" , & option_single_branch ,
93
96
N_ ("clone only one branch, HEAD or --branch" )),
94
97
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)
852
855
usage_msg_opt (_ ("You must specify a repository to clone." ),
853
856
builtin_clone_usage , builtin_clone_options );
854
857
855
- if (option_depth || option_since )
858
+ if (option_depth || option_since || option_not . nr )
856
859
deepen = 1 ;
857
860
if (option_single_branch == -1 )
858
861
option_single_branch = deepen ? 1 : 0 ;
@@ -983,6 +986,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
983
986
warning (_ ("--depth is ignored in local clones; use file:// instead." ));
984
987
if (option_since )
985
988
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." ));
986
991
if (!access (mkpath ("%s/shallow" , path ), F_OK )) {
987
992
if (option_local > 0 )
988
993
warning (_ ("source repository is shallow, ignoring --local" ));
@@ -1004,6 +1009,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
1004
1009
if (option_since )
1005
1010
transport_set_option (transport , TRANS_OPT_DEEPEN_SINCE ,
1006
1011
option_since );
1012
+ if (option_not .nr )
1013
+ transport_set_option (transport , TRANS_OPT_DEEPEN_NOT ,
1014
+ (const char * )& option_not );
1007
1015
if (option_single_branch )
1008
1016
transport_set_option (transport , TRANS_OPT_FOLLOWTAGS , "1" );
1009
1017
0 commit comments