@@ -256,7 +256,7 @@ int git_attr_foreach(
256256static int preload_attr_file (
257257 git_repository * repo ,
258258 git_attr_session * attr_session ,
259- git_attr_file_source source ,
259+ git_attr_file_source_t source_type ,
260260 const char * base ,
261261 const char * file ,
262262 bool allow_macros )
@@ -266,8 +266,10 @@ static int preload_attr_file(
266266
267267 if (!file )
268268 return 0 ;
269- if (!(error = git_attr_cache__get (& preload , repo , attr_session , source , base , file ,
270- git_attr_file__parse_buffer , allow_macros )))
269+ if (!(error = git_attr_cache__get (& preload , repo , attr_session ,
270+ source_type , base , file ,
271+ git_attr_file__parse_buffer ,
272+ allow_macros )))
271273 git_attr_file__free (preload );
272274
273275 return error ;
@@ -333,36 +335,36 @@ static int attr_setup(
333335 */
334336
335337 if ((error = system_attr_file (& path , attr_session )) < 0 ||
336- (error = preload_attr_file (repo , attr_session , GIT_ATTR_FILE__FROM_FILE ,
338+ (error = preload_attr_file (repo , attr_session , GIT_ATTR_FILE_SOURCE_FILE ,
337339 NULL , path .ptr , true)) < 0 ) {
338340 if (error != GIT_ENOTFOUND )
339341 goto out ;
340342 }
341343
342- if ((error = preload_attr_file (repo , attr_session , GIT_ATTR_FILE__FROM_FILE ,
344+ if ((error = preload_attr_file (repo , attr_session , GIT_ATTR_FILE_SOURCE_FILE ,
343345 NULL , git_repository_attr_cache (repo )-> cfg_attr_file , true)) < 0 )
344346 goto out ;
345347
346348 git_buf_clear (& path ); /* git_repository_item_path expects an empty buffer, because it uses git_buf_set */
347349 if ((error = git_repository_item_path (& path , repo , GIT_REPOSITORY_ITEM_INFO )) < 0 ||
348- (error = preload_attr_file (repo , attr_session , GIT_ATTR_FILE__FROM_FILE ,
350+ (error = preload_attr_file (repo , attr_session , GIT_ATTR_FILE_SOURCE_FILE ,
349351 path .ptr , GIT_ATTR_FILE_INREPO , true)) < 0 ) {
350352 if (error != GIT_ENOTFOUND )
351353 goto out ;
352354 }
353355
354356 if ((workdir = git_repository_workdir (repo )) != NULL &&
355- (error = preload_attr_file (repo , attr_session , GIT_ATTR_FILE__FROM_FILE ,
357+ (error = preload_attr_file (repo , attr_session , GIT_ATTR_FILE_SOURCE_FILE ,
356358 workdir , GIT_ATTR_FILE , true)) < 0 )
357359 goto out ;
358360
359361 if ((error = git_repository_index__weakptr (& idx , repo )) < 0 ||
360- (error = preload_attr_file (repo , attr_session , GIT_ATTR_FILE__FROM_INDEX ,
362+ (error = preload_attr_file (repo , attr_session , GIT_ATTR_FILE_SOURCE_INDEX ,
361363 NULL , GIT_ATTR_FILE , true)) < 0 )
362364 goto out ;
363365
364366 if ((flags & GIT_ATTR_CHECK_INCLUDE_HEAD ) != 0 &&
365- (error = preload_attr_file (repo , attr_session , GIT_ATTR_FILE__FROM_HEAD ,
367+ (error = preload_attr_file (repo , attr_session , GIT_ATTR_FILE_SOURCE_HEAD ,
366368 NULL , GIT_ATTR_FILE , true)) < 0 )
367369 goto out ;
368370
@@ -422,31 +424,34 @@ typedef struct {
422424} attr_walk_up_info ;
423425
424426static int attr_decide_sources (
425- uint32_t flags , bool has_wd , bool has_index , git_attr_file_source * srcs )
427+ uint32_t flags ,
428+ bool has_wd ,
429+ bool has_index ,
430+ git_attr_file_source_t * srcs )
426431{
427432 int count = 0 ;
428433
429434 switch (flags & 0x03 ) {
430435 case GIT_ATTR_CHECK_FILE_THEN_INDEX :
431436 if (has_wd )
432- srcs [count ++ ] = GIT_ATTR_FILE__FROM_FILE ;
437+ srcs [count ++ ] = GIT_ATTR_FILE_SOURCE_FILE ;
433438 if (has_index )
434- srcs [count ++ ] = GIT_ATTR_FILE__FROM_INDEX ;
439+ srcs [count ++ ] = GIT_ATTR_FILE_SOURCE_INDEX ;
435440 break ;
436441 case GIT_ATTR_CHECK_INDEX_THEN_FILE :
437442 if (has_index )
438- srcs [count ++ ] = GIT_ATTR_FILE__FROM_INDEX ;
443+ srcs [count ++ ] = GIT_ATTR_FILE_SOURCE_INDEX ;
439444 if (has_wd )
440- srcs [count ++ ] = GIT_ATTR_FILE__FROM_FILE ;
445+ srcs [count ++ ] = GIT_ATTR_FILE_SOURCE_FILE ;
441446 break ;
442447 case GIT_ATTR_CHECK_INDEX_ONLY :
443448 if (has_index )
444- srcs [count ++ ] = GIT_ATTR_FILE__FROM_INDEX ;
449+ srcs [count ++ ] = GIT_ATTR_FILE_SOURCE_INDEX ;
445450 break ;
446451 }
447452
448453 if ((flags & GIT_ATTR_CHECK_INCLUDE_HEAD ) != 0 )
449- srcs [count ++ ] = GIT_ATTR_FILE__FROM_HEAD ;
454+ srcs [count ++ ] = GIT_ATTR_FILE_SOURCE_HEAD ;
450455
451456 return count ;
452457}
@@ -455,7 +460,7 @@ static int push_attr_file(
455460 git_repository * repo ,
456461 git_attr_session * attr_session ,
457462 git_vector * list ,
458- git_attr_file_source source ,
463+ git_attr_file_source_t source_type ,
459464 const char * base ,
460465 const char * filename ,
461466 bool allow_macros )
@@ -464,7 +469,9 @@ static int push_attr_file(
464469 git_attr_file * file = NULL ;
465470
466471 error = git_attr_cache__get (& file , repo , attr_session ,
467- source , base , filename , git_attr_file__parse_buffer , allow_macros );
472+ source_type , base , filename ,
473+ git_attr_file__parse_buffer ,
474+ allow_macros );
468475
469476 if (error < 0 )
470477 return error ;
@@ -480,7 +487,7 @@ static int push_attr_file(
480487static int push_one_attr (void * ref , const char * path )
481488{
482489 attr_walk_up_info * info = (attr_walk_up_info * )ref ;
483- git_attr_file_source src [GIT_ATTR_FILE_NUM_SOURCES ];
490+ git_attr_file_source_t src [GIT_ATTR_FILE_NUM_SOURCES ];
484491 int error = 0 , n_src , i ;
485492 bool allow_macros ;
486493
@@ -542,7 +549,7 @@ static int collect_attr_files(
542549 */
543550
544551 if ((error = git_repository_item_path (& attrfile , repo , GIT_REPOSITORY_ITEM_INFO )) < 0 ||
545- (error = push_attr_file (repo , attr_session , files , GIT_ATTR_FILE__FROM_FILE ,
552+ (error = push_attr_file (repo , attr_session , files , GIT_ATTR_FILE_SOURCE_FILE ,
546553 attrfile .ptr , GIT_ATTR_FILE_INREPO , true)) < 0 ) {
547554 if (error != GIT_ENOTFOUND )
548555 goto cleanup ;
@@ -565,7 +572,7 @@ static int collect_attr_files(
565572 goto cleanup ;
566573
567574 if (git_repository_attr_cache (repo )-> cfg_attr_file != NULL ) {
568- error = push_attr_file (repo , attr_session , files , GIT_ATTR_FILE__FROM_FILE ,
575+ error = push_attr_file (repo , attr_session , files , GIT_ATTR_FILE_SOURCE_FILE ,
569576 NULL , git_repository_attr_cache (repo )-> cfg_attr_file , true);
570577 if (error < 0 )
571578 goto cleanup ;
@@ -575,7 +582,7 @@ static int collect_attr_files(
575582 error = system_attr_file (& dir , attr_session );
576583
577584 if (!error )
578- error = push_attr_file (repo , attr_session , files , GIT_ATTR_FILE__FROM_FILE ,
585+ error = push_attr_file (repo , attr_session , files , GIT_ATTR_FILE_SOURCE_FILE ,
579586 NULL , dir .ptr , true);
580587 else if (error == GIT_ENOTFOUND )
581588 error = 0 ;
0 commit comments