6
6
*/
7
7
8
8
#include "rugged.h"
9
- #include <ruby/thread.h>
10
9
11
10
extern VALUE rb_mRugged ;
12
11
VALUE rb_cRuggedDiff ;
@@ -198,22 +197,6 @@ static int diff_print_cb(
198
197
return GIT_OK ;
199
198
}
200
199
201
- struct nogvl_diff_patch_args {
202
- git_diff * diff ;
203
- git_diff_format_t format ;
204
- VALUE rb_str ;
205
- };
206
-
207
- static void * rb_git_diff_patch_nogvl (void * _args )
208
- {
209
- struct nogvl_diff_patch_args * args ;
210
-
211
- args = (struct nogvl_diff_patch_args * )_args ;
212
- git_diff_print (args -> diff , args -> format , diff_print_cb , (void * ) args -> rb_str );
213
-
214
- return NULL ;
215
- }
216
-
217
200
/*
218
201
* call-seq:
219
202
* diff.patch -> patch
@@ -226,25 +209,20 @@ static VALUE rb_git_diff_patch(int argc, VALUE *argv, VALUE self)
226
209
git_diff * diff ;
227
210
VALUE rb_str = rb_str_new (NULL , 0 );
228
211
VALUE rb_opts ;
229
- struct nogvl_diff_patch_args args ;
230
- git_diff_format_t format = GIT_DIFF_FORMAT_PATCH ;
231
212
232
213
rb_scan_args (argc , argv , "00:" , & rb_opts );
233
214
234
215
Data_Get_Struct (self , git_diff , diff );
235
216
236
217
if (!NIL_P (rb_opts )) {
237
218
if (rb_hash_aref (rb_opts , CSTR2SYM ("compact" )) == Qtrue )
238
- format = GIT_DIFF_FORMAT_NAME_STATUS ;
219
+ git_diff_print ( diff , GIT_DIFF_FORMAT_NAME_STATUS , diff_print_cb , ( void * ) rb_str ) ;
239
220
else
240
- format = GIT_DIFF_FORMAT_PATCH ;
221
+ git_diff_print (diff , GIT_DIFF_FORMAT_PATCH , diff_print_cb , (void * )rb_str );
222
+ } else {
223
+ git_diff_print (diff , GIT_DIFF_FORMAT_PATCH , diff_print_cb , (void * )rb_str );
241
224
}
242
225
243
- args .diff = diff ;
244
- args .format = format ;
245
- args .rb_str = rb_str ;
246
- rb_thread_call_without_gvl (rb_git_diff_patch_nogvl , & args , RUBY_UBF_PROCESS , NULL );
247
-
248
226
return rb_str ;
249
227
}
250
228
0 commit comments