1
- #define USE_THE_REPOSITORY_VARIABLE
2
1
#define DISABLE_SIGN_COMPARE_WARNINGS
3
2
4
3
#include "git-compat-util.h"
@@ -63,7 +62,8 @@ static int decode_tree_entry_raw(struct object_id *oid, const char **path,
63
62
return 0 ;
64
63
}
65
64
66
- static int convert_tree_object (struct strbuf * out ,
65
+ static int convert_tree_object (struct repository * repo ,
66
+ struct strbuf * out ,
67
67
const struct git_hash_algo * from ,
68
68
const struct git_hash_algo * to ,
69
69
const char * buffer , size_t size )
@@ -78,7 +78,7 @@ static int convert_tree_object(struct strbuf *out,
78
78
if (decode_tree_entry_raw (& entry_oid , & path , & pathlen , from , p ,
79
79
end - p ))
80
80
return error (_ ("failed to decode tree entry" ));
81
- if (repo_oid_to_algop (the_repository , & entry_oid , to , & mapped_oid ))
81
+ if (repo_oid_to_algop (repo , & entry_oid , to , & mapped_oid ))
82
82
return error (_ ("failed to map tree entry for %s" ), oid_to_hex (& entry_oid ));
83
83
strbuf_add (out , p , path - p );
84
84
strbuf_add (out , path , pathlen );
@@ -88,7 +88,8 @@ static int convert_tree_object(struct strbuf *out,
88
88
return 0 ;
89
89
}
90
90
91
- static int convert_tag_object (struct strbuf * out ,
91
+ static int convert_tag_object (struct repository * repo ,
92
+ struct strbuf * out ,
92
93
const struct git_hash_algo * from ,
93
94
const struct git_hash_algo * to ,
94
95
const char * buffer , size_t size )
@@ -105,7 +106,7 @@ static int convert_tag_object(struct strbuf *out,
105
106
return error ("bogus tag object" );
106
107
if (parse_oid_hex_algop (buffer + 7 , & oid , & p , from ) < 0 )
107
108
return error ("bad tag object ID" );
108
- if (repo_oid_to_algop (the_repository , & oid , to , & mapped_oid ))
109
+ if (repo_oid_to_algop (repo , & oid , to , & mapped_oid ))
109
110
return error ("unable to map tree %s in tag object" ,
110
111
oid_to_hex (& oid ));
111
112
size -= ((p + 1 ) - buffer );
@@ -139,7 +140,8 @@ static int convert_tag_object(struct strbuf *out,
139
140
return 0 ;
140
141
}
141
142
142
- static int convert_commit_object (struct strbuf * out ,
143
+ static int convert_commit_object (struct repository * repo ,
144
+ struct strbuf * out ,
143
145
const struct git_hash_algo * from ,
144
146
const struct git_hash_algo * to ,
145
147
const char * buffer , size_t size )
@@ -165,7 +167,7 @@ static int convert_commit_object(struct strbuf *out,
165
167
(p != eol ))
166
168
return error (_ ("bad %s in commit" ), "tree" );
167
169
168
- if (repo_oid_to_algop (the_repository , & oid , to , & mapped_oid ))
170
+ if (repo_oid_to_algop (repo , & oid , to , & mapped_oid ))
169
171
return error (_ ("unable to map %s %s in commit object" ),
170
172
"tree" , oid_to_hex (& oid ));
171
173
strbuf_addf (out , "tree %s\n" , oid_to_hex (& mapped_oid ));
@@ -177,7 +179,7 @@ static int convert_commit_object(struct strbuf *out,
177
179
(p != eol ))
178
180
return error (_ ("bad %s in commit" ), "parent" );
179
181
180
- if (repo_oid_to_algop (the_repository , & oid , to , & mapped_oid ))
182
+ if (repo_oid_to_algop (repo , & oid , to , & mapped_oid ))
181
183
return error (_ ("unable to map %s %s in commit object" ),
182
184
"parent" , oid_to_hex (& oid ));
183
185
@@ -202,7 +204,7 @@ static int convert_commit_object(struct strbuf *out,
202
204
}
203
205
204
206
/* Compute the new tag object */
205
- if (convert_tag_object (& new_tag , from , to , tag .buf , tag .len )) {
207
+ if (convert_tag_object (repo , & new_tag , from , to , tag .buf , tag .len )) {
206
208
strbuf_release (& tag );
207
209
strbuf_release (& new_tag );
208
210
return -1 ;
@@ -241,7 +243,8 @@ static int convert_commit_object(struct strbuf *out,
241
243
return 0 ;
242
244
}
243
245
244
- int convert_object_file (struct strbuf * outbuf ,
246
+ int convert_object_file (struct repository * repo ,
247
+ struct strbuf * outbuf ,
245
248
const struct git_hash_algo * from ,
246
249
const struct git_hash_algo * to ,
247
250
const void * buf , size_t len ,
@@ -256,13 +259,13 @@ int convert_object_file(struct strbuf *outbuf,
256
259
257
260
switch (type ) {
258
261
case OBJ_COMMIT :
259
- ret = convert_commit_object (outbuf , from , to , buf , len );
262
+ ret = convert_commit_object (repo , outbuf , from , to , buf , len );
260
263
break ;
261
264
case OBJ_TREE :
262
- ret = convert_tree_object (outbuf , from , to , buf , len );
265
+ ret = convert_tree_object (repo , outbuf , from , to , buf , len );
263
266
break ;
264
267
case OBJ_TAG :
265
- ret = convert_tag_object (outbuf , from , to , buf , len );
268
+ ret = convert_tag_object (repo , outbuf , from , to , buf , len );
266
269
break ;
267
270
default :
268
271
/* Not implemented yet, so fail. */
0 commit comments