@@ -30,6 +30,9 @@ static int gently_parse_list_objects_filter(
30
30
{
31
31
const char * v0 ;
32
32
33
+ if (!arg )
34
+ return 0 ;
35
+
33
36
if (filter_options -> choice ) {
34
37
if (errbuf ) {
35
38
strbuf_addstr (
@@ -146,6 +149,7 @@ void partial_clone_register(
146
149
const struct list_objects_filter_options * filter_options )
147
150
{
148
151
char * cfg_name ;
152
+ char * filter_name ;
149
153
150
154
/* Check if it is already registered */
151
155
if (!promisor_remote_find (remote )) {
@@ -160,27 +164,26 @@ void partial_clone_register(
160
164
/*
161
165
* Record the initial filter-spec in the config as
162
166
* the default for subsequent fetches from this remote.
163
- *
164
- * TODO: record it into remote.<name>.partialclonefilter
165
167
*/
166
- core_partial_clone_filter_default =
167
- xstrdup (filter_options -> filter_spec );
168
- git_config_set ("core.partialclonefilter" ,
169
- core_partial_clone_filter_default );
168
+ filter_name = xstrfmt ("remote.%s.partialclonefilter" , remote );
169
+ git_config_set (filter_name , filter_options -> filter_spec );
170
+ free (filter_name );
170
171
171
172
/* Make sure the config info are reset */
172
173
promisor_remote_reinit ();
173
174
}
174
175
175
176
void partial_clone_get_default_filter_spec (
176
- struct list_objects_filter_options * filter_options )
177
+ struct list_objects_filter_options * filter_options ,
178
+ const char * remote )
177
179
{
180
+ struct promisor_remote * promisor = promisor_remote_find (remote );
181
+
178
182
/*
179
183
* Parse default value, but silently ignore it if it is invalid.
180
184
*/
181
- if (!core_partial_clone_filter_default )
182
- return ;
183
- gently_parse_list_objects_filter (filter_options ,
184
- core_partial_clone_filter_default ,
185
- NULL );
185
+ if (promisor )
186
+ gently_parse_list_objects_filter (filter_options ,
187
+ promisor -> partial_clone_filter ,
188
+ NULL );
186
189
}
0 commit comments