1
1
use crate :: curl_helper:: BodyExt ;
2
+ use anyhow:: Context ;
2
3
use curl:: easy:: Easy ;
3
4
use rsa:: pkcs1:: DecodeRsaPrivateKey ;
4
5
use sha2:: Digest ;
@@ -132,7 +133,7 @@ impl RepositoryClient<'_> {
132
133
}
133
134
134
135
pub ( crate ) fn tag ( & mut self , tag : CreateTag < ' _ > ) -> anyhow:: Result < ( ) > {
135
- #[ derive( serde:: Serialize ) ]
136
+ #[ derive( Debug , serde:: Serialize ) ]
136
137
struct CreateTagInternal < ' a > {
137
138
tag : & ' a str ,
138
139
message : & ' a str ,
@@ -143,7 +144,7 @@ impl RepositoryClient<'_> {
143
144
tagger : CreateTagTaggerInternal < ' a > ,
144
145
}
145
146
146
- #[ derive( serde:: Serialize ) ]
147
+ #[ derive( Debug , serde:: Serialize ) ]
147
148
struct CreateTagTaggerInternal < ' a > {
148
149
name : & ' a str ,
149
150
email : & ' a str ,
@@ -159,19 +160,21 @@ impl RepositoryClient<'_> {
159
160
"https://api.github.com/repos/{repository}/git/tags" ,
160
161
repository = self . repo,
161
162
) ) ?;
163
+ let request = CreateTagInternal {
164
+ tag : tag. tag_name ,
165
+ message : tag. message ,
166
+ object : tag. commit ,
167
+ type_ : "commit" ,
168
+ tagger : CreateTagTaggerInternal {
169
+ name : tag. tagger_name ,
170
+ email : tag. tagger_email ,
171
+ } ,
172
+ } ;
162
173
let created = self
163
174
. client
164
- . with_body ( CreateTagInternal {
165
- tag : tag. tag_name ,
166
- message : tag. message ,
167
- object : tag. commit ,
168
- type_ : "commit" ,
169
- tagger : CreateTagTaggerInternal {
170
- name : tag. tagger_name ,
171
- email : tag. tagger_email ,
172
- } ,
173
- } )
174
- . send_with_response :: < CreatedTag > ( ) ?;
175
+ . with_body ( & request)
176
+ . send_with_response :: < CreatedTag > ( )
177
+ . with_context ( || format ! ( "tag request {:?}" , request) ) ?;
175
178
176
179
self . create_ref ( & format ! ( "refs/tags/{}" , tag. tag_name) , & created. sha ) ?;
177
180
0 commit comments