Skip to content

Commit 1756d16

Browse files
committed
Revert "Merge pull request #774 from stanhu/sh-allow-diff-patch-no-gvl"
This reverts commit fb9b327, reversing changes made to ca994bb. The GVL changes were found to cause lockups in the Ruby VM causing systems to become unresponsive.
1 parent a2313f6 commit 1756d16

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

ext/rugged/rugged_diff.c

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77

88
#include "rugged.h"
9-
#include <ruby/thread.h>
109

1110
extern VALUE rb_mRugged;
1211
VALUE rb_cRuggedDiff;
@@ -198,20 +197,6 @@ static int diff_print_cb(
198197
return GIT_OK;
199198
}
200199

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-
215200
/*
216201
* call-seq:
217202
* diff.patch -> patch
@@ -224,25 +209,20 @@ static VALUE rb_git_diff_patch(int argc, VALUE *argv, VALUE self)
224209
git_diff *diff;
225210
VALUE rb_str = rb_str_new(NULL, 0);
226211
VALUE rb_opts;
227-
struct nogvl_diff_patch_args args;
228-
git_diff_format_t format = GIT_DIFF_FORMAT_PATCH;
229212

230213
rb_scan_args(argc, argv, "00:", &rb_opts);
231214

232215
Data_Get_Struct(self, git_diff, diff);
233216

234217
if (!NIL_P(rb_opts)) {
235218
if (rb_hash_aref(rb_opts, CSTR2SYM("compact")) == Qtrue)
236-
format = GIT_DIFF_FORMAT_NAME_STATUS;
219+
git_diff_print(diff, GIT_DIFF_FORMAT_NAME_STATUS, diff_print_cb, (void*)rb_str);
237220
else
238-
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);
239224
}
240225

241-
args.diff = diff;
242-
args.format = format;
243-
args.rb_str = rb_str;
244-
rb_thread_call_without_gvl(rb_git_diff_patch_nogvl, &args, RUBY_UBF_PROCESS, NULL);
245-
246226
return rb_str;
247227
}
248228

0 commit comments

Comments
 (0)