1- #define USE_THE_REPOSITORY_VARIABLE
21#define DISABLE_SIGN_COMPARE_WARNINGS
32
43#include "git-compat-util.h"
1312#include "gpg-interface.h"
1413#include "hex.h"
1514#include "packfile.h"
15+ #include "repository.h"
1616
1717const char * tag_type = "tag" ;
1818
@@ -44,28 +44,28 @@ static int run_gpg_verify(const char *buf, unsigned long size, unsigned flags)
4444 return ret ;
4545}
4646
47- int gpg_verify_tag (const struct object_id * oid , const char * name_to_report ,
48- unsigned flags )
47+ int gpg_verify_tag (struct repository * r , const struct object_id * oid ,
48+ const char * name_to_report , unsigned flags )
4949{
5050 enum object_type type ;
5151 char * buf ;
5252 unsigned long size ;
5353 int ret ;
5454
55- type = odb_read_object_info (the_repository -> objects , oid , NULL );
55+ type = odb_read_object_info (r -> objects , oid , NULL );
5656 if (type != OBJ_TAG )
5757 return error ("%s: cannot verify a non-tag object of type %s." ,
5858 name_to_report ?
5959 name_to_report :
60- repo_find_unique_abbrev ( the_repository , oid , DEFAULT_ABBREV ),
60+ oid_to_hex ( oid ),
6161 type_name (type ));
6262
63- buf = odb_read_object (the_repository -> objects , oid , & type , & size );
63+ buf = odb_read_object (r -> objects , oid , & type , & size );
6464 if (!buf )
6565 return error ("%s: unable to read file." ,
6666 name_to_report ?
6767 name_to_report :
68- repo_find_unique_abbrev ( the_repository , oid , DEFAULT_ABBREV ));
68+ oid_to_hex ( oid ));
6969
7070 ret = run_gpg_verify (buf , size , flags );
7171
@@ -148,9 +148,11 @@ int parse_tag_buffer(struct repository *r, struct tag *item, const void *data, u
148148 FREE_AND_NULL (item -> tag );
149149 }
150150
151- if (size < the_hash_algo -> hexsz + 24 )
151+ if (size < r -> hash_algo -> hexsz + 24 )
152152 return -1 ;
153- if (memcmp ("object " , bufptr , 7 ) || parse_oid_hex (bufptr + 7 , & oid , & bufptr ) || * bufptr ++ != '\n' )
153+ if (memcmp ("object " , bufptr , 7 ) ||
154+ parse_oid_hex_algop (bufptr + 7 , & oid , & bufptr , r -> hash_algo ) ||
155+ * bufptr ++ != '\n' )
154156 return -1 ;
155157
156158 if (!starts_with (bufptr , "type " ))
@@ -201,7 +203,7 @@ int parse_tag_buffer(struct repository *r, struct tag *item, const void *data, u
201203 return 0 ;
202204}
203205
204- int parse_tag (struct tag * item )
206+ int parse_tag (struct repository * r , struct tag * item )
205207{
206208 enum object_type type ;
207209 void * data ;
@@ -210,8 +212,7 @@ int parse_tag(struct tag *item)
210212
211213 if (item -> object .parsed )
212214 return 0 ;
213- data = odb_read_object (the_repository -> objects , & item -> object .oid ,
214- & type , & size );
215+ data = odb_read_object (r -> objects , & item -> object .oid , & type , & size );
215216 if (!data )
216217 return error ("Could not read %s" ,
217218 oid_to_hex (& item -> object .oid ));
@@ -220,7 +221,7 @@ int parse_tag(struct tag *item)
220221 return error ("Object %s not a tag" ,
221222 oid_to_hex (& item -> object .oid ));
222223 }
223- ret = parse_tag_buffer (the_repository , item , data , size );
224+ ret = parse_tag_buffer (r , item , data , size );
224225 free (data );
225226 return ret ;
226227}
0 commit comments