@@ -19,17 +19,17 @@ int check_everything_connected(sha1_iterate_fn fn, int quiet, void *cb_data)
19
19
*
20
20
* Returns 0 if everything is connected, non-zero otherwise.
21
21
*/
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 )
26
27
{
27
28
struct child_process rev_list ;
28
- const char * argv [] = {"rev-list" , "--objects" ,
29
- "--stdin" , "--not" , "--all" , NULL , NULL };
29
+ const char * argv [9 ];
30
30
char commit [41 ];
31
31
unsigned char sha1 [20 ];
32
- int err = 0 ;
32
+ int err = 0 , ac = 0 ;
33
33
struct packed_git * new_pack = NULL ;
34
34
35
35
if (fn (cb_data , sha1 ))
@@ -47,8 +47,18 @@ int check_everything_connected_with_transport(sha1_iterate_fn fn,
47
47
strbuf_release (& idx_file );
48
48
}
49
49
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" ;
50
59
if (quiet )
51
- argv [5 ] = "--quiet" ;
60
+ argv [ac ++ ] = "--quiet" ;
61
+ argv [ac ] = NULL ;
52
62
53
63
memset (& rev_list , 0 , sizeof (rev_list ));
54
64
rev_list .argv = argv ;
@@ -92,3 +102,19 @@ int check_everything_connected_with_transport(sha1_iterate_fn fn,
92
102
sigchain_pop (SIGPIPE );
93
103
return finish_command (& rev_list ) || err ;
94
104
}
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