@@ -19,17 +19,17 @@ int check_everything_connected(sha1_iterate_fn fn, int quiet, void *cb_data)
1919 *
2020 * Returns 0 if everything is connected, non-zero otherwise.
2121 */
22- int check_everything_connected_with_transport (sha1_iterate_fn fn ,
23- int quiet ,
24- void * cb_data ,
25- struct transport * transport )
22+ static int check_everything_connected_real (sha1_iterate_fn fn ,
23+ int quiet ,
24+ void * cb_data ,
25+ struct transport * transport ,
26+ const char * shallow_file )
2627{
2728 struct child_process rev_list ;
28- const char * argv [] = {"rev-list" , "--objects" ,
29- "--stdin" , "--not" , "--all" , NULL , NULL };
29+ const char * argv [9 ];
3030 char commit [41 ];
3131 unsigned char sha1 [20 ];
32- int err = 0 ;
32+ int err = 0 , ac = 0 ;
3333 struct packed_git * new_pack = NULL ;
3434
3535 if (fn (cb_data , sha1 ))
@@ -47,8 +47,18 @@ int check_everything_connected_with_transport(sha1_iterate_fn fn,
4747 strbuf_release (& idx_file );
4848 }
4949
50+ if (shallow_file ) {
51+ argv [ac ++ ] = "--shallow-file" ;
52+ argv [ac ++ ] = shallow_file ;
53+ }
54+ argv [ac ++ ] = "rev-list" ;
55+ argv [ac ++ ] = "--objects" ;
56+ argv [ac ++ ] = "--stdin" ;
57+ argv [ac ++ ] = "--not" ;
58+ argv [ac ++ ] = "--all" ;
5059 if (quiet )
51- argv [5 ] = "--quiet" ;
60+ argv [ac ++ ] = "--quiet" ;
61+ argv [ac ] = NULL ;
5262
5363 memset (& rev_list , 0 , sizeof (rev_list ));
5464 rev_list .argv = argv ;
@@ -92,3 +102,19 @@ int check_everything_connected_with_transport(sha1_iterate_fn fn,
92102 sigchain_pop (SIGPIPE );
93103 return finish_command (& rev_list ) || err ;
94104}
105+
106+ int check_everything_connected_with_transport (sha1_iterate_fn fn ,
107+ int quiet ,
108+ void * cb_data ,
109+ struct transport * transport )
110+ {
111+ return check_everything_connected_real (fn , quiet , cb_data ,
112+ transport , NULL );
113+ }
114+
115+ int check_shallow_connected (sha1_iterate_fn fn , int quiet , void * cb_data ,
116+ const char * shallow_file )
117+ {
118+ return check_everything_connected_real (fn , quiet , cb_data ,
119+ NULL , shallow_file );
120+ }
0 commit comments