@@ -1291,7 +1291,8 @@ struct conv_attrs {
12911291 const char * working_tree_encoding ; /* Supported encoding or default encoding if NULL */
12921292};
12931293
1294- static void convert_attrs (struct conv_attrs * ca , const char * path )
1294+ static void convert_attrs (const struct index_state * istate ,
1295+ struct conv_attrs * ca , const char * path )
12951296{
12961297 static struct attr_check * check ;
12971298
@@ -1303,7 +1304,7 @@ static void convert_attrs(struct conv_attrs *ca, const char *path)
13031304 git_config (read_convert_config , NULL );
13041305 }
13051306
1306- if (!git_check_attr (& the_index , path , check )) {
1307+ if (!git_check_attr (istate , path , check )) {
13071308 struct attr_check_item * ccheck = check -> items ;
13081309 ca -> crlf_action = git_path_check_crlf (ccheck + 4 );
13091310 if (ca -> crlf_action == CRLF_UNDEFINED )
@@ -1340,11 +1341,11 @@ static void convert_attrs(struct conv_attrs *ca, const char *path)
13401341 ca -> crlf_action = CRLF_AUTO_INPUT ;
13411342}
13421343
1343- int would_convert_to_git_filter_fd (const char * path )
1344+ int would_convert_to_git_filter_fd (const struct index_state * istate , const char * path )
13441345{
13451346 struct conv_attrs ca ;
13461347
1347- convert_attrs (& ca , path );
1348+ convert_attrs (istate , & ca , path );
13481349 if (!ca .drv )
13491350 return 0 ;
13501351
@@ -1359,11 +1360,11 @@ int would_convert_to_git_filter_fd(const char *path)
13591360 return apply_filter (path , NULL , 0 , -1 , NULL , ca .drv , CAP_CLEAN , NULL );
13601361}
13611362
1362- const char * get_convert_attr_ascii (const char * path )
1363+ const char * get_convert_attr_ascii (const struct index_state * istate , const char * path )
13631364{
13641365 struct conv_attrs ca ;
13651366
1366- convert_attrs (& ca , path );
1367+ convert_attrs (istate , & ca , path );
13671368 switch (ca .attr_action ) {
13681369 case CRLF_UNDEFINED :
13691370 return "" ;
@@ -1392,7 +1393,7 @@ int convert_to_git(const struct index_state *istate,
13921393 int ret = 0 ;
13931394 struct conv_attrs ca ;
13941395
1395- convert_attrs (& ca , path );
1396+ convert_attrs (istate , & ca , path );
13961397
13971398 ret |= apply_filter (path , src , len , -1 , dst , ca .drv , CAP_CLEAN , NULL );
13981399 if (!ret && ca .drv && ca .drv -> required )
@@ -1424,7 +1425,7 @@ void convert_to_git_filter_fd(const struct index_state *istate,
14241425 int conv_flags )
14251426{
14261427 struct conv_attrs ca ;
1427- convert_attrs (& ca , path );
1428+ convert_attrs (istate , & ca , path );
14281429
14291430 assert (ca .drv );
14301431 assert (ca .drv -> clean || ca .drv -> process );
@@ -1437,14 +1438,15 @@ void convert_to_git_filter_fd(const struct index_state *istate,
14371438 ident_to_git (path , dst -> buf , dst -> len , dst , ca .ident );
14381439}
14391440
1440- static int convert_to_working_tree_internal (const char * path , const char * src ,
1441+ static int convert_to_working_tree_internal (const struct index_state * istate ,
1442+ const char * path , const char * src ,
14411443 size_t len , struct strbuf * dst ,
14421444 int normalizing , struct delayed_checkout * dco )
14431445{
14441446 int ret = 0 , ret_filter = 0 ;
14451447 struct conv_attrs ca ;
14461448
1447- convert_attrs (& ca , path );
1449+ convert_attrs (istate , & ca , path );
14481450
14491451 ret |= ident_to_worktree (path , src , len , dst , ca .ident );
14501452 if (ret ) {
@@ -1478,22 +1480,25 @@ static int convert_to_working_tree_internal(const char *path, const char *src,
14781480 return ret | ret_filter ;
14791481}
14801482
1481- int async_convert_to_working_tree (const char * path , const char * src ,
1483+ int async_convert_to_working_tree (const struct index_state * istate ,
1484+ const char * path , const char * src ,
14821485 size_t len , struct strbuf * dst ,
14831486 void * dco )
14841487{
1485- return convert_to_working_tree_internal (path , src , len , dst , 0 , dco );
1488+ return convert_to_working_tree_internal (istate , path , src , len , dst , 0 , dco );
14861489}
14871490
1488- int convert_to_working_tree (const char * path , const char * src , size_t len , struct strbuf * dst )
1491+ int convert_to_working_tree (const struct index_state * istate ,
1492+ const char * path , const char * src ,
1493+ size_t len , struct strbuf * dst )
14891494{
1490- return convert_to_working_tree_internal (path , src , len , dst , 0 , NULL );
1495+ return convert_to_working_tree_internal (istate , path , src , len , dst , 0 , NULL );
14911496}
14921497
14931498int renormalize_buffer (const struct index_state * istate , const char * path ,
14941499 const char * src , size_t len , struct strbuf * dst )
14951500{
1496- int ret = convert_to_working_tree_internal (path , src , len , dst , 1 , NULL );
1501+ int ret = convert_to_working_tree_internal (istate , path , src , len , dst , 1 , NULL );
14971502 if (ret ) {
14981503 src = dst -> buf ;
14991504 len = dst -> len ;
@@ -1927,12 +1932,14 @@ static struct stream_filter *ident_filter(const struct object_id *oid)
19271932 * Note that you would be crazy to set CRLF, smuge/clean or ident to a
19281933 * large binary blob you would want us not to slurp into the memory!
19291934 */
1930- struct stream_filter * get_stream_filter (const char * path , const struct object_id * oid )
1935+ struct stream_filter * get_stream_filter (const struct index_state * istate ,
1936+ const char * path ,
1937+ const struct object_id * oid )
19311938{
19321939 struct conv_attrs ca ;
19331940 struct stream_filter * filter = NULL ;
19341941
1935- convert_attrs (& ca , path );
1942+ convert_attrs (istate , & ca , path );
19361943 if (ca .drv && (ca .drv -> process || ca .drv -> smudge || ca .drv -> clean ))
19371944 return NULL ;
19381945
0 commit comments