1
- #define USE_THE_REPOSITORY_VARIABLE
2
-
3
1
#include "git-compat-util.h"
4
2
#include "abspath.h"
5
3
#include "commit-graph.h"
@@ -476,12 +474,13 @@ void odb_add_submodule_source_by_path(struct object_database *odb,
476
474
string_list_insert (& odb -> submodule_source_paths , path );
477
475
}
478
476
479
- static void fill_alternate_refs_command (struct child_process * cmd ,
477
+ static void fill_alternate_refs_command (struct repository * repo ,
478
+ struct child_process * cmd ,
480
479
const char * repo_path )
481
480
{
482
481
const char * value ;
483
482
484
- if (!git_config_get_value ( "core.alternateRefsCommand" , & value )) {
483
+ if (!repo_config_get_value ( repo , "core.alternateRefsCommand" , & value )) {
485
484
cmd -> use_shell = 1 ;
486
485
487
486
strvec_push (& cmd -> args , value );
@@ -493,7 +492,7 @@ static void fill_alternate_refs_command(struct child_process *cmd,
493
492
strvec_push (& cmd -> args , "for-each-ref" );
494
493
strvec_push (& cmd -> args , "--format=%(objectname)" );
495
494
496
- if (!git_config_get_value ( "core.alternateRefsPrefixes" , & value )) {
495
+ if (!repo_config_get_value ( repo , "core.alternateRefsPrefixes" , & value )) {
497
496
strvec_push (& cmd -> args , "--" );
498
497
strvec_split (& cmd -> args , value );
499
498
}
@@ -503,15 +502,16 @@ static void fill_alternate_refs_command(struct child_process *cmd,
503
502
cmd -> out = -1 ;
504
503
}
505
504
506
- static void read_alternate_refs (const char * path ,
505
+ static void read_alternate_refs (struct repository * repo ,
506
+ const char * path ,
507
507
odb_for_each_alternate_ref_fn * cb ,
508
508
void * payload )
509
509
{
510
510
struct child_process cmd = CHILD_PROCESS_INIT ;
511
511
struct strbuf line = STRBUF_INIT ;
512
512
FILE * fh ;
513
513
514
- fill_alternate_refs_command (& cmd , path );
514
+ fill_alternate_refs_command (repo , & cmd , path );
515
515
516
516
if (start_command (& cmd ))
517
517
return ;
@@ -521,7 +521,7 @@ static void read_alternate_refs(const char *path,
521
521
struct object_id oid ;
522
522
const char * p ;
523
523
524
- if (parse_oid_hex (line .buf , & oid , & p ) || * p ) {
524
+ if (parse_oid_hex_algop (line .buf , & oid , & p , repo -> hash_algo ) || * p ) {
525
525
warning (_ ("invalid line while parsing alternate refs: %s" ),
526
526
line .buf );
527
527
break ;
@@ -559,7 +559,7 @@ static int refs_from_alternate_cb(struct odb_source *alternate,
559
559
goto out ;
560
560
strbuf_setlen (& path , base_len );
561
561
562
- read_alternate_refs (path .buf , cb -> fn , cb -> payload );
562
+ read_alternate_refs (alternate -> odb -> repo , path .buf , cb -> fn , cb -> payload );
563
563
564
564
out :
565
565
strbuf_release (& path );
@@ -677,7 +677,7 @@ static int do_oid_object_info_extended(struct repository *r,
677
677
if (oi -> disk_sizep )
678
678
* (oi -> disk_sizep ) = 0 ;
679
679
if (oi -> delta_base_oid )
680
- oidclr (oi -> delta_base_oid , the_repository -> hash_algo );
680
+ oidclr (oi -> delta_base_oid , r -> hash_algo );
681
681
if (oi -> contentp )
682
682
* oi -> contentp = xmemdupz (co -> buf , co -> size );
683
683
oi -> whence = OI_CACHED ;
@@ -763,10 +763,10 @@ static int oid_object_info_convert(struct repository *r,
763
763
void * content ;
764
764
int ret ;
765
765
766
- if (repo_oid_to_algop (r , input_oid , the_hash_algo , & oid )) {
766
+ if (repo_oid_to_algop (r , input_oid , r -> hash_algo , & oid )) {
767
767
if (do_die )
768
768
die (_ ("missing mapping of %s to %s" ),
769
- oid_to_hex (input_oid ), the_hash_algo -> name );
769
+ oid_to_hex (input_oid ), r -> hash_algo -> name );
770
770
return -1 ;
771
771
}
772
772
@@ -797,8 +797,8 @@ static int oid_object_info_convert(struct repository *r,
797
797
struct strbuf outbuf = STRBUF_INIT ;
798
798
799
799
if (type != OBJ_BLOB ) {
800
- ret = convert_object_file (the_repository , & outbuf ,
801
- the_hash_algo , input_algo ,
800
+ ret = convert_object_file (r , & outbuf ,
801
+ r -> hash_algo , input_algo ,
802
802
content , size , type , !do_die );
803
803
free (content );
804
804
if (ret == -1 )
@@ -944,9 +944,9 @@ void *read_object_with_reference(struct repository *r,
944
944
}
945
945
ref_length = strlen (ref_type );
946
946
947
- if (ref_length + the_hash_algo -> hexsz > isize ||
947
+ if (ref_length + r -> hash_algo -> hexsz > isize ||
948
948
memcmp (buffer , ref_type , ref_length ) ||
949
- get_oid_hex ((char * ) buffer + ref_length , & actual_oid )) {
949
+ get_oid_hex_algop ((char * ) buffer + ref_length , & actual_oid , r -> hash_algo )) {
950
950
free (buffer );
951
951
return NULL ;
952
952
}
0 commit comments