@@ -672,7 +672,7 @@ static struct cmd2process *start_multi_file_filter(struct hashmap *hashmap, cons
672
672
}
673
673
674
674
static int apply_multi_file_filter (const char * path , const char * src , size_t len ,
675
- int fd , struct strbuf * dst , const char * cmd ,
675
+ int fd , struct strbuf * dst , int * delayed , const char * cmd ,
676
676
const unsigned int wanted_capability )
677
677
{
678
678
int err ;
@@ -738,9 +738,14 @@ static int apply_multi_file_filter(const char *path, const char *src, size_t len
738
738
goto done ;
739
739
740
740
read_multi_file_filter_status (process -> out , & filter_status );
741
- err = strcmp (filter_status .buf , "success" );
742
- if ( err )
741
+ if ( delayed && ! strcmp (filter_status .buf , "delayed" )) {
742
+ * delayed = 1 ;
743
743
goto done ;
744
+ } else {
745
+ err = strcmp (filter_status .buf , "success" );
746
+ if (err )
747
+ goto done ;
748
+ }
744
749
745
750
err = read_packetized_to_strbuf (process -> out , & nbuf ) < 0 ;
746
751
if (err )
@@ -787,8 +792,8 @@ static struct convert_driver {
787
792
} * user_convert , * * user_convert_tail ;
788
793
789
794
static int apply_filter (const char * path , const char * src , size_t len ,
790
- int fd , struct strbuf * dst , struct convert_driver * drv ,
791
- const unsigned int wanted_capability )
795
+ int fd , struct strbuf * dst , int * delayed ,
796
+ struct convert_driver * drv , const unsigned int wanted_capability )
792
797
{
793
798
const char * cmd = NULL ;
794
799
@@ -806,7 +811,7 @@ static int apply_filter(const char *path, const char *src, size_t len,
806
811
if (cmd && * cmd )
807
812
return apply_single_file_filter (path , src , len , fd , dst , cmd );
808
813
else if (drv -> process && * drv -> process )
809
- return apply_multi_file_filter (path , src , len , fd , dst , drv -> process , wanted_capability );
814
+ return apply_multi_file_filter (path , src , len , fd , dst , delayed , drv -> process , wanted_capability );
810
815
811
816
return 0 ;
812
817
}
@@ -1152,7 +1157,7 @@ int would_convert_to_git_filter_fd(const char *path)
1152
1157
if (!ca .drv -> required )
1153
1158
return 0 ;
1154
1159
1155
- return apply_filter (path , NULL , 0 , -1 , NULL , ca .drv , CAP_CLEAN );
1160
+ return apply_filter (path , NULL , 0 , -1 , NULL , NULL , ca .drv , CAP_CLEAN );
1156
1161
}
1157
1162
1158
1163
const char * get_convert_attr_ascii (const char * path )
@@ -1189,7 +1194,7 @@ int convert_to_git(const char *path, const char *src, size_t len,
1189
1194
1190
1195
convert_attrs (& ca , path );
1191
1196
1192
- ret |= apply_filter (path , src , len , -1 , dst , ca .drv , CAP_CLEAN );
1197
+ ret |= apply_filter (path , src , len , -1 , dst , NULL , ca .drv , CAP_CLEAN );
1193
1198
if (!ret && ca .drv && ca .drv -> required )
1194
1199
die ("%s: clean filter '%s' failed" , path , ca .drv -> name );
1195
1200
@@ -1214,15 +1219,15 @@ void convert_to_git_filter_fd(const char *path, int fd, struct strbuf *dst,
1214
1219
assert (ca .drv );
1215
1220
assert (ca .drv -> clean || ca .drv -> process );
1216
1221
1217
- if (!apply_filter (path , NULL , 0 , fd , dst , ca .drv , CAP_CLEAN ))
1222
+ if (!apply_filter (path , NULL , 0 , fd , dst , NULL , ca .drv , CAP_CLEAN ))
1218
1223
die ("%s: clean filter '%s' failed" , path , ca .drv -> name );
1219
1224
1220
1225
crlf_to_git (path , dst -> buf , dst -> len , dst , ca .crlf_action , checksafe );
1221
1226
ident_to_git (path , dst -> buf , dst -> len , dst , ca .ident );
1222
1227
}
1223
1228
1224
1229
static int convert_to_working_tree_internal (const char * path , const char * src ,
1225
- size_t len , struct strbuf * dst ,
1230
+ size_t len , struct strbuf * dst , int * delayed ,
1226
1231
int normalizing )
1227
1232
{
1228
1233
int ret = 0 , ret_filter = 0 ;
@@ -1248,21 +1253,21 @@ static int convert_to_working_tree_internal(const char *path, const char *src,
1248
1253
}
1249
1254
}
1250
1255
1251
- ret_filter = apply_filter (path , src , len , -1 , dst , ca .drv , CAP_SMUDGE );
1256
+ ret_filter = apply_filter (path , src , len , -1 , dst , delayed , ca .drv , CAP_SMUDGE );
1252
1257
if (!ret_filter && ca .drv && ca .drv -> required )
1253
1258
die ("%s: smudge filter %s failed" , path , ca .drv -> name );
1254
1259
1255
1260
return ret | ret_filter ;
1256
1261
}
1257
1262
1258
- int convert_to_working_tree (const char * path , const char * src , size_t len , struct strbuf * dst )
1263
+ int convert_to_working_tree (const char * path , const char * src , size_t len , struct strbuf * dst , int * delayed )
1259
1264
{
1260
- return convert_to_working_tree_internal (path , src , len , dst , 0 );
1265
+ return convert_to_working_tree_internal (path , src , len , dst , delayed , 0 );
1261
1266
}
1262
1267
1263
1268
int renormalize_buffer (const char * path , const char * src , size_t len , struct strbuf * dst )
1264
1269
{
1265
- int ret = convert_to_working_tree_internal (path , src , len , dst , 1 );
1270
+ int ret = convert_to_working_tree_internal (path , src , len , dst , NULL , 1 );
1266
1271
if (ret ) {
1267
1272
src = dst -> buf ;
1268
1273
len = dst -> len ;
0 commit comments