6
6
*/
7
7
8
8
#include "rugged.h"
9
+ #include <ruby/thread.h>
9
10
10
11
extern VALUE rb_mRugged ;
11
12
extern VALUE rb_cRuggedObject ;
@@ -363,13 +364,31 @@ static VALUE rb_git_diff_tree_to_index(VALUE self, VALUE rb_repo, VALUE rb_self,
363
364
return rugged_diff_new (rb_cRuggedDiff , rb_repo , diff );
364
365
}
365
366
367
+ struct nogvl_diff_args {
368
+ git_repository * repo ;
369
+ git_tree * tree ;
370
+ git_tree * other_tree ;
371
+ git_diff_options * opts ;
372
+ int error ;
373
+ };
374
+
375
+ static void * rb_git_diff_tree_to_tree_nogvl (void * _args )
376
+ {
377
+ struct nogvl_diff_args * args ;
378
+ git_diff * diff = NULL ;
379
+
380
+ args = (struct nogvl_diff_args * )_args ;
381
+ args -> error = git_diff_tree_to_tree (& diff , args -> repo , args -> tree , args -> other_tree , args -> opts );
382
+ return diff ;
383
+ }
384
+
366
385
static VALUE rb_git_diff_tree_to_tree (VALUE self , VALUE rb_repo , VALUE rb_tree , VALUE rb_other_tree , VALUE rb_options ) {
367
386
git_tree * tree = NULL ;
368
387
git_tree * other_tree = NULL ;
369
388
git_diff_options opts = GIT_DIFF_OPTIONS_INIT ;
370
389
git_repository * repo = NULL ;
371
390
git_diff * diff = NULL ;
372
- int error ;
391
+ struct nogvl_diff_args args ;
373
392
374
393
Data_Get_Struct (rb_repo , git_repository , repo );
375
394
Data_Get_Struct (rb_tree , git_tree , tree );
@@ -379,10 +398,15 @@ static VALUE rb_git_diff_tree_to_tree(VALUE self, VALUE rb_repo, VALUE rb_tree,
379
398
380
399
rugged_parse_diff_options (& opts , rb_options );
381
400
382
- error = git_diff_tree_to_tree (& diff , repo , tree , other_tree , & opts );
401
+ args .repo = repo ;
402
+ args .tree = tree ;
403
+ args .other_tree = other_tree ;
404
+ args .opts = & opts ;
405
+
406
+ diff = rb_thread_call_without_gvl (rb_git_diff_tree_to_tree_nogvl , & args , RUBY_UBF_PROCESS , NULL );
383
407
384
408
xfree (opts .pathspec .strings );
385
- rugged_exception_check (error );
409
+ rugged_exception_check (args . error );
386
410
387
411
return rugged_diff_new (rb_cRuggedDiff , rb_repo , diff );
388
412
}
0 commit comments