rugged 1.9.0 → 1.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/extconf.rb +4 -4
  3. data/ext/rugged/rugged.c +12 -1
  4. data/ext/rugged/rugged_blame.c +22 -6
  5. data/ext/rugged/rugged_blob.c +24 -9
  6. data/ext/rugged/rugged_branch.c +10 -7
  7. data/ext/rugged/rugged_branch_collection.c +8 -6
  8. data/ext/rugged/rugged_commit.c +7 -6
  9. data/ext/rugged/rugged_config.c +20 -11
  10. data/ext/rugged/rugged_diff.c +26 -12
  11. data/ext/rugged/rugged_diff_hunk.c +2 -1
  12. data/ext/rugged/rugged_index.c +39 -29
  13. data/ext/rugged/rugged_note.c +7 -6
  14. data/ext/rugged/rugged_object.c +3 -2
  15. data/ext/rugged/rugged_patch.c +23 -9
  16. data/ext/rugged/rugged_rebase.c +22 -10
  17. data/ext/rugged/rugged_reference.c +22 -13
  18. data/ext/rugged/rugged_reference_collection.c +9 -7
  19. data/ext/rugged/rugged_remote.c +23 -12
  20. data/ext/rugged/rugged_remote_collection.c +11 -9
  21. data/ext/rugged/rugged_repo.c +60 -45
  22. data/ext/rugged/rugged_revwalk.c +22 -12
  23. data/ext/rugged/rugged_submodule.c +23 -20
  24. data/ext/rugged/rugged_submodule_collection.c +20 -9
  25. data/ext/rugged/rugged_tag.c +6 -4
  26. data/ext/rugged/rugged_tag_collection.c +7 -5
  27. data/ext/rugged/rugged_tree.c +27 -15
  28. data/lib/rugged/version.rb +1 -1
  29. data/vendor/libgit2/AUTHORS +2 -0
  30. data/vendor/libgit2/CMakeLists.txt +1 -1
  31. data/vendor/libgit2/cmake/DefaultCFlags.cmake +4 -1
  32. data/vendor/libgit2/cmake/SelectSSH.cmake +9 -3
  33. data/vendor/libgit2/deps/pcre/CMakeLists.txt +2 -3
  34. data/vendor/libgit2/deps/xdiff/CMakeLists.txt +1 -1
  35. data/vendor/libgit2/deps/xdiff/xmerge.c +14 -10
  36. data/vendor/libgit2/include/git2/deprecated.h +1 -1
  37. data/vendor/libgit2/include/git2/index.h +1 -1
  38. data/vendor/libgit2/include/git2/merge.h +4 -2
  39. data/vendor/libgit2/include/git2/oid.h +0 -1
  40. data/vendor/libgit2/include/git2/proxy.h +2 -3
  41. data/vendor/libgit2/include/git2/remote.h +19 -7
  42. data/vendor/libgit2/include/git2/stdint.h +1 -1
  43. data/vendor/libgit2/include/git2/sys/transport.h +1 -1
  44. data/vendor/libgit2/include/git2/version.h +4 -2
  45. data/vendor/libgit2/src/cli/CMakeLists.txt +1 -2
  46. data/vendor/libgit2/src/cli/opt.c +3 -3
  47. data/vendor/libgit2/src/cli/opt_usage.c +1 -1
  48. data/vendor/libgit2/src/libgit2/CMakeLists.txt +32 -16
  49. data/vendor/libgit2/src/libgit2/attr_file.c +10 -3
  50. data/vendor/libgit2/src/libgit2/clone.c +6 -0
  51. data/vendor/libgit2/src/libgit2/commit.c +1 -1
  52. data/vendor/libgit2/src/libgit2/commit_graph.c +1 -2
  53. data/vendor/libgit2/src/libgit2/config.c +1 -1
  54. data/vendor/libgit2/src/libgit2/config_file.c +2 -1
  55. data/vendor/libgit2/src/libgit2/config_mem.c +1 -0
  56. data/vendor/libgit2/src/libgit2/config_parse.c +2 -1
  57. data/vendor/libgit2/src/libgit2/delta.c +5 -1
  58. data/vendor/libgit2/src/libgit2/diff_driver.c +1 -1
  59. data/vendor/libgit2/src/libgit2/diff_stats.c +19 -12
  60. data/vendor/libgit2/src/libgit2/fetchhead.c +1 -1
  61. data/vendor/libgit2/src/libgit2/index.c +8 -8
  62. data/vendor/libgit2/src/libgit2/index.h +3 -0
  63. data/vendor/libgit2/src/libgit2/indexer.c +2 -2
  64. data/vendor/libgit2/src/libgit2/merge.c +1 -1
  65. data/vendor/libgit2/src/libgit2/merge.h +4 -0
  66. data/vendor/libgit2/src/libgit2/merge_file.c +43 -30
  67. data/vendor/libgit2/src/libgit2/message.c +1 -1
  68. data/vendor/libgit2/src/libgit2/midx.c +2 -3
  69. data/vendor/libgit2/src/libgit2/odb.c +2 -6
  70. data/vendor/libgit2/src/libgit2/odb_loose.c +24 -14
  71. data/vendor/libgit2/src/libgit2/oid.c +4 -5
  72. data/vendor/libgit2/src/libgit2/pack-objects.c +2 -4
  73. data/vendor/libgit2/src/libgit2/pack.c +3 -0
  74. data/vendor/libgit2/src/libgit2/refs.c +15 -6
  75. data/vendor/libgit2/src/libgit2/remote.c +4 -1
  76. data/vendor/libgit2/src/libgit2/remote.h +0 -1
  77. data/vendor/libgit2/src/libgit2/repository.c +5 -4
  78. data/vendor/libgit2/src/libgit2/streams/socket.c +30 -0
  79. data/vendor/libgit2/src/libgit2/submodule.c +12 -5
  80. data/vendor/libgit2/src/libgit2/tag.c +3 -1
  81. data/vendor/libgit2/src/libgit2/transports/auth_sspi.c +2 -0
  82. data/vendor/libgit2/src/libgit2/transports/credential.c +1 -1
  83. data/vendor/libgit2/src/libgit2/transports/git.c +1 -1
  84. data/vendor/libgit2/src/libgit2/transports/httpclient.c +12 -9
  85. data/vendor/libgit2/src/libgit2/transports/local.c +8 -1
  86. data/vendor/libgit2/src/libgit2/transports/smart.c +5 -5
  87. data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +3 -3
  88. data/vendor/libgit2/src/libgit2/transports/ssh_exec.c +57 -18
  89. data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.c +3 -3
  90. data/vendor/libgit2/src/util/CMakeLists.txt +3 -4
  91. data/vendor/libgit2/src/util/fs_path.c +66 -6
  92. data/vendor/libgit2/src/util/fs_path.h +6 -0
  93. data/vendor/libgit2/src/util/futils.h +11 -3
  94. data/vendor/libgit2/src/util/hash/builtin.c +14 -4
  95. data/vendor/libgit2/src/util/hash/openssl.c +0 -4
  96. data/vendor/libgit2/src/util/hash/rfc6234/sha224-256.c +8 -6
  97. data/vendor/libgit2/src/util/hashmap.h +1 -0
  98. data/vendor/libgit2/src/util/net.c +5 -5
  99. data/vendor/libgit2/src/util/process.h +2 -1
  100. data/vendor/libgit2/src/util/runtime.c +2 -2
  101. data/vendor/libgit2/src/util/str.c +18 -6
  102. data/vendor/libgit2/src/util/str.h +5 -3
  103. data/vendor/libgit2/src/util/unix/process.c +92 -15
  104. data/vendor/libgit2/src/util/util.c +16 -3
  105. data/vendor/libgit2/src/util/util.h +1 -0
  106. data/vendor/libgit2/src/util/win32/path_w32.c +81 -5
  107. data/vendor/libgit2/src/util/win32/process.c +22 -6
  108. metadata +17 -6
@@ -12,15 +12,25 @@ extern VALUE rb_cRuggedObject;
12
12
  VALUE rb_cRuggedWalker;
13
13
 
14
14
  extern const rb_data_type_t rugged_object_type;
15
+ extern const rb_data_type_t rugged_repository_type;
15
16
 
16
- static void rb_git_walk__free(git_revwalk *walk)
17
+ static void rb_git_walk__free(void *data)
17
18
  {
19
+ git_revwalk *walk = (git_revwalk *) data;
18
20
  git_revwalk_free(walk);
19
21
  }
20
22
 
23
+ const rb_data_type_t rugged_walk_type = {
24
+ .wrap_struct_name = "Rugged::Walker",
25
+ .function = {
26
+ .dfree = rb_git_walk__free,
27
+ },
28
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY,
29
+ };
30
+
21
31
  VALUE rugged_walker_new(VALUE klass, VALUE owner, git_revwalk *walk)
22
32
  {
23
- VALUE rb_walk = Data_Wrap_Struct(klass, NULL, &rb_git_walk__free, walk);
33
+ VALUE rb_walk = TypedData_Wrap_Struct(klass, &rugged_walk_type, walk);
24
34
  rugged_set_owner(rb_walk, owner);
25
35
  return rb_walk;
26
36
  }
@@ -90,7 +100,7 @@ static VALUE rb_git_walker_new(VALUE klass, VALUE rb_repo)
90
100
  git_revwalk *walk;
91
101
  int error;
92
102
 
93
- Data_Get_Struct(rb_repo, git_repository, repo);
103
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
94
104
 
95
105
  error = git_revwalk_new(&walk, repo);
96
106
  rugged_exception_check(error);
@@ -117,7 +127,7 @@ static VALUE rb_git_walker_new(VALUE klass, VALUE rb_repo)
117
127
  static VALUE rb_git_walker_push(VALUE self, VALUE rb_commit)
118
128
  {
119
129
  git_revwalk *walk;
120
- Data_Get_Struct(self, git_revwalk, walk);
130
+ TypedData_Get_Struct(self, git_revwalk, &rugged_walk_type, walk);
121
131
  push_commit(walk, rb_commit, 0);
122
132
  return Qnil;
123
133
  }
@@ -125,7 +135,7 @@ static VALUE rb_git_walker_push(VALUE self, VALUE rb_commit)
125
135
  static VALUE rb_git_walker_push_range(VALUE self, VALUE range)
126
136
  {
127
137
  git_revwalk *walk;
128
- Data_Get_Struct(self, git_revwalk, walk);
138
+ TypedData_Get_Struct(self, git_revwalk, &rugged_walk_type, walk);
129
139
  rugged_exception_check(git_revwalk_push_range(walk, StringValueCStr(range)));
130
140
  return Qnil;
131
141
  }
@@ -140,7 +150,7 @@ static VALUE rb_git_walker_push_range(VALUE self, VALUE range)
140
150
  static VALUE rb_git_walker_hide(VALUE self, VALUE rb_commit)
141
151
  {
142
152
  git_revwalk *walk;
143
- Data_Get_Struct(self, git_revwalk, walk);
153
+ TypedData_Get_Struct(self, git_revwalk, &rugged_walk_type, walk);
144
154
  push_commit(walk, rb_commit, 1);
145
155
  return Qnil;
146
156
  }
@@ -156,7 +166,7 @@ static VALUE rb_git_walker_hide(VALUE self, VALUE rb_commit)
156
166
  static VALUE rb_git_walker_sorting(VALUE self, VALUE ruby_sort_mode)
157
167
  {
158
168
  git_revwalk *walk;
159
- Data_Get_Struct(self, git_revwalk, walk);
169
+ TypedData_Get_Struct(self, git_revwalk, &rugged_walk_type, walk);
160
170
  git_revwalk_sorting(walk, FIX2INT(ruby_sort_mode));
161
171
  return Qnil;
162
172
  }
@@ -170,7 +180,7 @@ static VALUE rb_git_walker_sorting(VALUE self, VALUE ruby_sort_mode)
170
180
  static VALUE rb_git_walker_simplify_first_parent(VALUE self)
171
181
  {
172
182
  git_revwalk *walk;
173
- Data_Get_Struct(self, git_revwalk, walk);
183
+ TypedData_Get_Struct(self, git_revwalk, &rugged_walk_type, walk);
174
184
  git_revwalk_simplify_first_parent(walk);
175
185
  return Qnil;
176
186
  }
@@ -192,7 +202,7 @@ static VALUE rb_git_walker_count(int argc, VALUE *argv, VALUE self)
192
202
  if (argc > 0 || rb_block_given_p())
193
203
  return rb_call_super(argc, argv);
194
204
 
195
- Data_Get_Struct(self, git_revwalk, walk);
205
+ TypedData_Get_Struct(self, git_revwalk, &rugged_walk_type, walk);
196
206
 
197
207
  while (((error = git_revwalk_next(&commit_oid, walk)) == 0) && ++count != UINT64_MAX);
198
208
 
@@ -212,7 +222,7 @@ static VALUE rb_git_walker_count(int argc, VALUE *argv, VALUE self)
212
222
  static VALUE rb_git_walker_reset(VALUE self)
213
223
  {
214
224
  git_revwalk *walk;
215
- Data_Get_Struct(self, git_revwalk, walk);
225
+ TypedData_Get_Struct(self, git_revwalk, &rugged_walk_type, walk);
216
226
  git_revwalk_reset(walk);
217
227
  return Qnil;
218
228
  }
@@ -370,7 +380,7 @@ static VALUE rb_git_walk(int argc, VALUE *argv, VALUE self)
370
380
  RETURN_ENUMERATOR(self, argc, argv);
371
381
  rb_scan_args(argc, argv, "10:", &rb_repo, &rb_options);
372
382
 
373
- Data_Get_Struct(rb_repo, git_repository, w.repo);
383
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, w.repo);
374
384
  rugged_exception_check(git_revwalk_new(&w.walk, w.repo));
375
385
 
376
386
  w.rb_owner = rb_repo;
@@ -402,7 +412,7 @@ static VALUE rb_git_walk_with_opts(int argc, VALUE *argv, VALUE self, int oid_on
402
412
  RETURN_ENUMERATOR(self, argc, argv);
403
413
  rb_scan_args(argc, argv, "01", &rb_options);
404
414
 
405
- Data_Get_Struct(self, git_revwalk, w.walk);
415
+ TypedData_Get_Struct(self, git_revwalk, &rugged_walk_type, w.walk);
406
416
  w.repo = git_revwalk_repository(w.walk);
407
417
 
408
418
  w.rb_owner = rugged_owner(self);
@@ -18,6 +18,9 @@ static ID id_ignore_none, id_ignore_untracked, id_ignore_dirty, id_ignore_all;
18
18
 
19
19
  static ID id_update_checkout, id_update_rebase, id_update_merge, id_update_none;
20
20
 
21
+ extern const rb_data_type_t rugged_repository_type;
22
+ extern const rb_data_type_t rugged_submodule_type;
23
+
21
24
  void init_status_list(void)
22
25
  {
23
26
  id_in_head = CSTR2SYM("in_head");
@@ -153,8 +156,8 @@ static VALUE rb_git_submodule_status(VALUE self)
153
156
  unsigned int flags;
154
157
 
155
158
  rugged_check_repo(rb_repo);
156
- Data_Get_Struct(rb_repo, git_repository, repo);
157
- Data_Get_Struct(self, git_submodule, submodule);
159
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
160
+ TypedData_Get_Struct(self, git_submodule, &rugged_submodule_type, submodule);
158
161
 
159
162
  rugged_exception_check(
160
163
  git_submodule_status(&flags, repo, git_submodule_name(submodule),
@@ -168,7 +171,7 @@ static VALUE rb_git_submodule_status(VALUE self)
168
171
  #define RB_GIT_SUBMODULE_LOCATION_FLAG_CHECK(flag) \
169
172
  git_submodule *submodule; \
170
173
  unsigned int flags; \
171
- Data_Get_Struct(self, git_submodule, submodule); \
174
+ TypedData_Get_Struct(self, git_submodule, &rugged_submodule_type, submodule); \
172
175
  rugged_exception_check( \
173
176
  git_submodule_location(&flags, submodule) \
174
177
  ); \
@@ -224,8 +227,8 @@ static VALUE rb_git_submodule_status_in_workdir(VALUE self)
224
227
  git_submodule *submodule; \
225
228
  unsigned int flags; \
226
229
  rugged_check_repo(rb_repo); \
227
- Data_Get_Struct(rb_repo, git_repository, repo); \
228
- Data_Get_Struct(self, git_submodule, submodule); \
230
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo); \
231
+ TypedData_Get_Struct(self, git_submodule, &rugged_submodule_type, submodule); \
229
232
  rugged_exception_check( \
230
233
  git_submodule_status(&flags, repo, git_submodule_name(submodule), \
231
234
  GIT_SUBMODULE_IGNORE_UNSPECIFIED) \
@@ -348,8 +351,8 @@ static VALUE rb_git_submodule_status_untracked_files_in_workdir(VALUE self)
348
351
  git_submodule *submodule; \
349
352
  unsigned int flags; \
350
353
  rugged_check_repo(rb_repo); \
351
- Data_Get_Struct(rb_repo, git_repository, repo); \
352
- Data_Get_Struct(self, git_submodule, submodule); \
354
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo); \
355
+ TypedData_Get_Struct(self, git_submodule, &rugged_submodule_type, submodule); \
353
356
  rugged_exception_check( \
354
357
  git_submodule_status(&flags, repo, git_submodule_name(submodule), \
355
358
  GIT_SUBMODULE_IGNORE_UNSPECIFIED) \
@@ -401,7 +404,7 @@ static VALUE rb_git_submodule_add_to_index(int argc, VALUE *argv, VALUE self)
401
404
  VALUE rb_options;
402
405
  int write_index = 1;
403
406
 
404
- Data_Get_Struct(self, git_submodule, submodule);
407
+ TypedData_Get_Struct(self, git_submodule, &rugged_submodule_type, submodule);
405
408
 
406
409
  rb_scan_args(argc, argv, ":", &rb_options);
407
410
 
@@ -431,7 +434,7 @@ static VALUE rb_git_submodule_add_to_index(int argc, VALUE *argv, VALUE self)
431
434
  static VALUE rb_git_submodule_reload(VALUE self)
432
435
  {
433
436
  git_submodule *submodule;
434
- Data_Get_Struct(self, git_submodule, submodule);
437
+ TypedData_Get_Struct(self, git_submodule, &rugged_submodule_type, submodule);
435
438
 
436
439
  rugged_exception_check(
437
440
  git_submodule_reload(submodule, 1)
@@ -454,7 +457,7 @@ static VALUE rb_git_submodule_reload(VALUE self)
454
457
  static VALUE rb_git_submodule_sync(VALUE self)
455
458
  {
456
459
  git_submodule *submodule;
457
- Data_Get_Struct(self, git_submodule, submodule);
460
+ TypedData_Get_Struct(self, git_submodule, &rugged_submodule_type, submodule);
458
461
 
459
462
  rugged_exception_check(
460
463
  git_submodule_sync(submodule)
@@ -485,7 +488,7 @@ static VALUE rb_git_submodule_init(int argc, VALUE *argv, VALUE self)
485
488
  VALUE rb_options;
486
489
  int overwrite = 0;
487
490
 
488
- Data_Get_Struct(self, git_submodule, submodule);
491
+ TypedData_Get_Struct(self, git_submodule, &rugged_submodule_type, submodule);
489
492
 
490
493
  rb_scan_args(argc, argv, ":", &rb_options);
491
494
 
@@ -514,7 +517,7 @@ static VALUE rb_git_submodule_name(VALUE self)
514
517
  git_submodule *submodule;
515
518
  const char *name;
516
519
 
517
- Data_Get_Struct(self, git_submodule, submodule);
520
+ TypedData_Get_Struct(self, git_submodule, &rugged_submodule_type, submodule);
518
521
 
519
522
  name = git_submodule_name(submodule);
520
523
 
@@ -533,7 +536,7 @@ static VALUE rb_git_submodule_url(VALUE self)
533
536
  git_submodule *submodule;
534
537
  const char *url;
535
538
 
536
- Data_Get_Struct(self, git_submodule, submodule);
539
+ TypedData_Get_Struct(self, git_submodule, &rugged_submodule_type, submodule);
537
540
 
538
541
  url = git_submodule_url(submodule);
539
542
 
@@ -554,7 +557,7 @@ static VALUE rb_git_submodule_path(VALUE self)
554
557
  git_submodule *submodule;
555
558
  const char *path;
556
559
 
557
- Data_Get_Struct(self, git_submodule, submodule);
560
+ TypedData_Get_Struct(self, git_submodule, &rugged_submodule_type, submodule);
558
561
 
559
562
  path = git_submodule_path(submodule);
560
563
 
@@ -564,7 +567,7 @@ static VALUE rb_git_submodule_path(VALUE self)
564
567
  #define RB_GIT_OID_GETTER(_klass, _attribute) \
565
568
  git_##_klass *object; \
566
569
  const git_oid * oid; \
567
- Data_Get_Struct(self, git_##_klass, object); \
570
+ TypedData_Get_Struct(self, git_##_klass, &rugged_##_klass##_type, object); \
568
571
  oid = git_##_klass##_##_attribute(object); \
569
572
  return oid ? rugged_create_oid(oid) : Qnil; \
570
573
 
@@ -625,7 +628,7 @@ static VALUE rb_git_submodule_wd_id(VALUE self)
625
628
  static VALUE rb_git_submodule_fetch_recurse_submodules(VALUE self)
626
629
  {
627
630
  git_submodule *submodule;
628
- Data_Get_Struct(self, git_submodule, submodule);
631
+ TypedData_Get_Struct(self, git_submodule, &rugged_submodule_type, submodule);
629
632
 
630
633
  return git_submodule_fetch_recurse_submodules(submodule) ? Qtrue : Qfalse;
631
634
  }
@@ -676,7 +679,7 @@ static VALUE rb_git_submodule_ignore_rule(VALUE self)
676
679
  git_submodule *submodule;
677
680
  git_submodule_ignore_t ignore;
678
681
 
679
- Data_Get_Struct(self, git_submodule, submodule);
682
+ TypedData_Get_Struct(self, git_submodule, &rugged_submodule_type, submodule);
680
683
  ignore = git_submodule_ignore(submodule);
681
684
 
682
685
  return rb_git_subm_ignore_rule_fromC(ignore);
@@ -723,7 +726,7 @@ static VALUE rb_git_submodule_update_rule(VALUE self)
723
726
  git_submodule *submodule;
724
727
  git_submodule_update_t update;
725
728
 
726
- Data_Get_Struct(self, git_submodule, submodule);
729
+ TypedData_Get_Struct(self, git_submodule, &rugged_submodule_type, submodule);
727
730
  update = git_submodule_update_strategy(submodule);
728
731
 
729
732
  return rb_git_subm_update_rule_fromC(update);
@@ -744,7 +747,7 @@ static VALUE rb_git_submodule_repository(VALUE self)
744
747
  git_submodule *submodule;
745
748
  git_repository *repo;
746
749
 
747
- Data_Get_Struct(self, git_submodule, submodule);
750
+ TypedData_Get_Struct(self, git_submodule, &rugged_submodule_type, submodule);
748
751
 
749
752
  rugged_exception_check(
750
753
  git_submodule_open(&repo, submodule)
@@ -769,7 +772,7 @@ static VALUE rb_git_submodule_repository(VALUE self)
769
772
  static VALUE rb_git_submodule_finalize_add(VALUE self)
770
773
  {
771
774
  git_submodule *submodule;
772
- Data_Get_Struct(self, git_submodule, submodule);
775
+ TypedData_Get_Struct(self, git_submodule, &rugged_submodule_type, submodule);
773
776
 
774
777
  rugged_exception_check(
775
778
  git_submodule_add_finalize(submodule)
@@ -11,6 +11,8 @@ extern VALUE rb_mRugged;
11
11
  extern VALUE rb_cRuggedSubmodule;
12
12
  VALUE rb_cRuggedSubmoduleCollection;
13
13
 
14
+ extern const rb_data_type_t rugged_repository_type;
15
+
14
16
  /*
15
17
  * call-seq:
16
18
  * SubmoduleCollection.new(repo) -> submodules
@@ -24,19 +26,28 @@ static VALUE rb_git_submodule_collection_initialize(VALUE self, VALUE rb_repo)
24
26
  return self;
25
27
  }
26
28
 
27
- static void rb_git_submodule__free(git_submodule *submodule)
29
+ static void rb_git_submodule__free(void *data)
28
30
  {
31
+ git_submodule *submodule = (git_submodule *) data;
29
32
  git_submodule_free(submodule);
30
33
  }
31
34
 
35
+ const rb_data_type_t rugged_submodule_type = {
36
+ .wrap_struct_name = "Rugged::Submodule",
37
+ .function = {
38
+ .dfree = rb_git_submodule__free,
39
+ },
40
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY,
41
+ };
42
+
43
+
32
44
  VALUE rugged_submodule_new(VALUE owner, git_submodule *submodule)
33
45
  {
34
46
  VALUE rb_submodule;
35
47
 
36
- rb_submodule = Data_Wrap_Struct(
48
+ rb_submodule = TypedData_Wrap_Struct(
37
49
  rb_cRuggedSubmodule,
38
- NULL,
39
- &rb_git_submodule__free,
50
+ &rugged_submodule_type,
40
51
  submodule);
41
52
  rugged_set_owner(rb_submodule, owner);
42
53
 
@@ -63,7 +74,7 @@ static VALUE rb_git_submodule_collection_aref(VALUE self, VALUE rb_name)
63
74
  int error;
64
75
 
65
76
  VALUE rb_repo = rugged_owner(self);
66
- Data_Get_Struct(rb_repo, git_repository, repo);
77
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
67
78
 
68
79
  Check_Type(rb_name, T_STRING);
69
80
 
@@ -89,7 +100,7 @@ static int cb_submodule__each(git_submodule *submodule, const char *name, void *
89
100
  VALUE rb_repo;
90
101
 
91
102
  rb_repo = payload->rb_data;
92
- Data_Get_Struct(rb_repo, git_repository, repo);
103
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
93
104
 
94
105
  /* The submodule passed here has it's refcount decreased just after
95
106
  * the foreach finishes. The only way to increase that refcount is
@@ -128,7 +139,7 @@ static VALUE rb_git_submodule_collection_each(VALUE self)
128
139
 
129
140
  RETURN_ENUMERATOR(self, 0, 0);
130
141
  rb_repo = rugged_owner(self);
131
- Data_Get_Struct(rb_repo, git_repository, repo);
142
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
132
143
 
133
144
  payload.exception = 0;
134
145
  payload.rb_data = rb_repo;
@@ -184,7 +195,7 @@ static VALUE rb_git_submodule_setup_add(int argc, VALUE *argv, VALUE self)
184
195
  Check_Type(rb_path, T_STRING);
185
196
 
186
197
  rb_repo = rugged_owner(self);
187
- Data_Get_Struct(rb_repo, git_repository, repo);
198
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
188
199
 
189
200
  if (!NIL_P(rb_options)) {
190
201
  VALUE rb_val;
@@ -281,7 +292,7 @@ static VALUE rb_git_submodule_update(VALUE self, VALUE rb_name_or_submodule, VAL
281
292
  VALUE rb_url, rb_fetch_recurse_submodules, rb_ignore_rule, rb_update_rule;
282
293
 
283
294
  rugged_check_repo(rb_repo);
284
- Data_Get_Struct(rb_repo, git_repository, repo);
295
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
285
296
 
286
297
  if (rb_obj_is_kind_of(rb_name_or_submodule, rb_cRuggedSubmodule))
287
298
  rb_name_or_submodule = rb_funcall(rb_name_or_submodule, rb_intern("name"), 0);
@@ -16,6 +16,8 @@ VALUE rb_cRuggedTag;
16
16
  VALUE rb_cRuggedTagAnnotation;
17
17
 
18
18
  extern const rb_data_type_t rugged_object_type;
19
+ extern const rb_data_type_t rugged_reference_type;
20
+ extern const rb_data_type_t rugged_repository_type;
19
21
 
20
22
  /*
21
23
  * call-seq:
@@ -160,8 +162,8 @@ static VALUE rb_git_tag_annotation(VALUE self)
160
162
  VALUE rb_repo = rugged_owner(self);
161
163
 
162
164
  rugged_check_repo(rb_repo);
163
- Data_Get_Struct(self, git_reference, ref);
164
- Data_Get_Struct(rb_repo, git_repository, repo);
165
+ TypedData_Get_Struct(self, git_reference, &rugged_reference_type, ref);
166
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
165
167
 
166
168
  error = git_reference_resolve(&resolved_ref, ref);
167
169
  rugged_exception_check(error);
@@ -188,8 +190,8 @@ static VALUE rb_git_tag_target(VALUE self)
188
190
  VALUE rb_repo = rugged_owner(self);
189
191
 
190
192
  rugged_check_repo(rb_repo);
191
- Data_Get_Struct(self, git_reference, ref);
192
- Data_Get_Struct(rb_repo, git_repository, repo);
193
+ TypedData_Get_Struct(self, git_reference, &rugged_reference_type, ref);
194
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
193
195
 
194
196
  error = git_reference_resolve(&resolved_ref, ref);
195
197
  rugged_exception_check(error);
@@ -13,6 +13,8 @@ extern VALUE rb_cRuggedTag;
13
13
 
14
14
  VALUE rb_cRuggedTagCollection;
15
15
 
16
+ extern const rb_data_type_t rugged_repository_type;
17
+
16
18
  /*
17
19
  * call-seq:
18
20
  * TagCollection.new(repo) -> refs
@@ -42,7 +44,7 @@ static VALUE rb_git_tag_collection_aref(VALUE self, VALUE rb_name)
42
44
  VALUE rb_repo = rugged_owner(self);
43
45
 
44
46
  rugged_check_repo(rb_repo);
45
- Data_Get_Struct(rb_repo, git_repository, repo);
47
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
46
48
 
47
49
  Check_Type(rb_name, T_STRING);
48
50
 
@@ -76,7 +78,7 @@ static VALUE rb_git_tag_collection_delete(VALUE self, VALUE rb_name)
76
78
  int error;
77
79
 
78
80
  rugged_check_repo(rb_repo);
79
- Data_Get_Struct(rb_repo, git_repository, repo);
81
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
80
82
 
81
83
  Check_Type(rb_name, T_STRING);
82
84
 
@@ -116,7 +118,7 @@ static VALUE rb_git_tag_collection_create(int argc, VALUE *argv, VALUE self)
116
118
  rb_scan_args(argc, argv, "21:", &rb_name, &rb_target, &rb_force, &rb_annotation);
117
119
 
118
120
  rugged_check_repo(rb_repo);
119
- Data_Get_Struct(rb_repo, git_repository, repo);
121
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
120
122
 
121
123
  Check_Type(rb_name, T_STRING);
122
124
 
@@ -194,7 +196,7 @@ static VALUE rb_git_tag_collection_create_annotation(VALUE self, VALUE rb_name,
194
196
 
195
197
  VALUE rb_repo = rugged_owner(self);
196
198
  rugged_check_repo(rb_repo);
197
- Data_Get_Struct(rb_repo, git_repository, repo);
199
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
198
200
 
199
201
  Check_Type(rb_name, T_STRING);
200
202
 
@@ -245,7 +247,7 @@ static VALUE each_tag(int argc, VALUE *argv, VALUE self, int tag_names_only)
245
247
  }
246
248
 
247
249
  rugged_check_repo(rb_repo);
248
- Data_Get_Struct(rb_repo, git_repository, repo);
250
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
249
251
 
250
252
  error = git_tag_list_match(&tags, pattern ? pattern : "", repo);
251
253
  rugged_exception_check(error);
@@ -18,7 +18,9 @@ extern VALUE rb_cRuggedCommit;
18
18
  VALUE rb_cRuggedTree;
19
19
  VALUE rb_cRuggedTreeBuilder;
20
20
 
21
+ extern const rb_data_type_t rugged_index_type;
21
22
  extern const rb_data_type_t rugged_object_type;
23
+ extern const rb_data_type_t rugged_repository_type;
22
24
 
23
25
  static VALUE rb_git_treeentry_fromC(const git_tree_entry *entry)
24
26
  {
@@ -348,8 +350,8 @@ static VALUE rb_git_diff_tree_to_index(VALUE self, VALUE rb_repo, VALUE rb_self,
348
350
  git_index *index;
349
351
  int error;
350
352
 
351
- Data_Get_Struct(rb_repo, git_repository, repo);
352
- Data_Get_Struct(rb_other, git_index, index);
353
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
354
+ TypedData_Get_Struct(rb_other, git_index, &rugged_index_type, index);
353
355
 
354
356
  rugged_parse_diff_options(&opts, rb_options);
355
357
 
@@ -391,7 +393,7 @@ static VALUE rb_git_diff_tree_to_tree(VALUE self, VALUE rb_repo, VALUE rb_tree,
391
393
  git_diff *diff = NULL;
392
394
  struct nogvl_diff_args args;
393
395
 
394
- Data_Get_Struct(rb_repo, git_repository, repo);
396
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
395
397
 
396
398
  if(RTEST(rb_tree))
397
399
  TypedData_Get_Struct(rb_tree, git_tree, &rugged_object_type, tree);
@@ -439,7 +441,7 @@ static VALUE rb_git_tree_diff_workdir(int argc, VALUE *argv, VALUE self)
439
441
 
440
442
  TypedData_Get_Struct(self, git_tree, &rugged_object_type, tree);
441
443
  owner = rugged_owner(self);
442
- Data_Get_Struct(owner, git_repository, repo);
444
+ TypedData_Get_Struct(owner, git_repository, &rugged_repository_type, repo);
443
445
 
444
446
  error = git_diff_tree_to_workdir(&diff, repo, tree, &opts);
445
447
 
@@ -561,7 +563,7 @@ static VALUE rb_git_tree_merge(int argc, VALUE *argv, VALUE self)
561
563
  rb_raise(rb_eTypeError, "Expecting a Rugged::Tree instance");
562
564
 
563
565
  TypedData_Get_Struct(self, git_tree, &rugged_object_type, tree);
564
- Data_Get_Struct(rb_repo, git_repository, repo);
566
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
565
567
  TypedData_Get_Struct(rb_other_tree, git_tree, &rugged_object_type, other_tree);
566
568
 
567
569
  if (!NIL_P(rb_ancestor_tree))
@@ -596,7 +598,7 @@ static VALUE rb_git_tree_empty(VALUE self, VALUE rb_repo)
596
598
  git_tree *tree;
597
599
 
598
600
  rugged_check_repo(rb_repo);
599
- Data_Get_Struct(rb_repo, git_repository, repo);
601
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
600
602
 
601
603
  rugged_exception_check(git_tree_lookup(&tree, repo, &empty_tree));
602
604
 
@@ -708,11 +710,21 @@ static VALUE rb_git_tree_update(VALUE self, VALUE rb_updates)
708
710
  return rugged_create_oid(&id);
709
711
  }
710
712
 
711
- static void rb_git_treebuilder_free(git_treebuilder *bld)
713
+ static void rb_git_treebuilder__free(void *data)
712
714
  {
715
+ git_treebuilder *bld = (git_treebuilder *) data;
713
716
  git_treebuilder_free(bld);
714
717
  }
715
718
 
719
+ const rb_data_type_t rugged_treebuilder_type = {
720
+ .wrap_struct_name = "Rugged::Tree::Builder",
721
+ .function = {
722
+ .dfree = rb_git_treebuilder__free,
723
+ },
724
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY,
725
+ };
726
+
727
+
716
728
  /*
717
729
  * call-seq:
718
730
  * Tree::Builder.new(repository, [tree])
@@ -740,12 +752,12 @@ static VALUE rb_git_treebuilder_new(int argc, VALUE *argv, VALUE klass)
740
752
  }
741
753
 
742
754
  rugged_check_repo(rb_repo);
743
- Data_Get_Struct(rb_repo, git_repository, repo);
755
+ TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
744
756
 
745
757
  error = git_treebuilder_new(&builder, repo, tree);
746
758
  rugged_exception_check(error);
747
759
 
748
- rb_builder = Data_Wrap_Struct(klass, NULL, &rb_git_treebuilder_free, builder);
760
+ rb_builder = TypedData_Wrap_Struct(klass, &rugged_treebuilder_type, builder);
749
761
  rugged_set_owner(rb_builder, rb_repo);
750
762
 
751
763
  return rb_builder;
@@ -760,7 +772,7 @@ static VALUE rb_git_treebuilder_new(int argc, VALUE *argv, VALUE klass)
760
772
  static VALUE rb_git_treebuilder_clear(VALUE self)
761
773
  {
762
774
  git_treebuilder *builder;
763
- Data_Get_Struct(self, git_treebuilder, builder);
775
+ TypedData_Get_Struct(self, git_treebuilder, &rugged_treebuilder_type, builder);
764
776
  git_treebuilder_clear(builder);
765
777
  return Qnil;
766
778
  }
@@ -774,7 +786,7 @@ static VALUE rb_git_treebuilder_clear(VALUE self)
774
786
  static VALUE rb_git_treebuilder_get(VALUE self, VALUE path)
775
787
  {
776
788
  git_treebuilder *builder;
777
- Data_Get_Struct(self, git_treebuilder, builder);
789
+ TypedData_Get_Struct(self, git_treebuilder, &rugged_treebuilder_type, builder);
778
790
 
779
791
  Check_Type(path, T_STRING);
780
792
 
@@ -795,7 +807,7 @@ static VALUE rb_git_treebuilder_insert(VALUE self, VALUE rb_entry)
795
807
  git_oid oid;
796
808
  int error;
797
809
 
798
- Data_Get_Struct(self, git_treebuilder, builder);
810
+ TypedData_Get_Struct(self, git_treebuilder, &rugged_treebuilder_type, builder);
799
811
  Check_Type(rb_entry, T_HASH);
800
812
 
801
813
  rb_path = rb_hash_aref(rb_entry, CSTR2SYM("name"));
@@ -832,7 +844,7 @@ static VALUE rb_git_treebuilder_remove(VALUE self, VALUE path)
832
844
  git_treebuilder *builder;
833
845
  int error;
834
846
 
835
- Data_Get_Struct(self, git_treebuilder, builder);
847
+ TypedData_Get_Struct(self, git_treebuilder, &rugged_treebuilder_type, builder);
836
848
  Check_Type(path, T_STRING);
837
849
 
838
850
  error = git_treebuilder_remove(builder, StringValueCStr(path));
@@ -860,7 +872,7 @@ static VALUE rb_git_treebuilder_write(VALUE self)
860
872
  git_oid written_id;
861
873
  int error;
862
874
 
863
- Data_Get_Struct(self, git_treebuilder, builder);
875
+ TypedData_Get_Struct(self, git_treebuilder, &rugged_treebuilder_type, builder);
864
876
 
865
877
  error = git_treebuilder_write(&written_id, builder);
866
878
  rugged_exception_check(error);
@@ -887,7 +899,7 @@ static VALUE rb_git_treebuilder_filter(VALUE self)
887
899
  git_treebuilder *builder;
888
900
 
889
901
  rb_need_block();
890
- Data_Get_Struct(self, git_treebuilder, builder);
902
+ TypedData_Get_Struct(self, git_treebuilder, &rugged_treebuilder_type, builder);
891
903
 
892
904
  git_treebuilder_filter(builder, &treebuilder_cb, (void *)rb_block_proc());
893
905
  return Qnil;
@@ -4,5 +4,5 @@
4
4
  # For full terms see the included LICENSE file.
5
5
 
6
6
  module Rugged
7
- Version = VERSION = '1.9.0'
7
+ Version = VERSION = '1.9.4'
8
8
  end
@@ -59,6 +59,7 @@ Romain Geissler
59
59
  Romain Muller
60
60
  Russell Belfer
61
61
  Sakari Jokinen
62
+ Sam Altier
62
63
  Samuel Charles "Sam" Day
63
64
  Sarath Lakshman
64
65
  Sascha Cunz
@@ -70,6 +71,7 @@ Shawn O. Pearce
70
71
  Shuhei Tanuma
71
72
  Steve Frécinaux
72
73
  Sven Strickroth
74
+ Talya "kivikakk" Connor
73
75
  Tim Branyen
74
76
  Tim Clem
75
77
  Tim Harder
@@ -6,7 +6,7 @@
6
6
 
7
7
  cmake_minimum_required(VERSION 3.5.1)
8
8
 
9
- project(libgit2 VERSION "1.9.0" LANGUAGES C)
9
+ project(libgit2 VERSION "1.9.4" LANGUAGES C)
10
10
 
11
11
  # Add find modules to the path
12
12
  set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
@@ -13,6 +13,9 @@ if(MSVC)
13
13
  # /Gd - explicitly set cdecl calling convention
14
14
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gd")
15
15
 
16
+ # Remove warnings about operands that use different enum types.
17
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd5287")
18
+
16
19
  if(NOT (MSVC_VERSION LESS 1900))
17
20
  # /guard:cf - Enable Control Flow Guard
18
21
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /guard:cf")
@@ -56,7 +59,7 @@ if(MSVC)
56
59
  set(CMAKE_C_FLAGS_MINSIZEREL "/DNDEBUG /O1 /Oy /GL /Gy ${CRT_FLAG_RELEASE}")
57
60
 
58
61
  # /IGNORE:4221 - Ignore empty compilation units
59
- set(CMAKE_STATIC_LINKER_FLAGS "/IGNORE:4221")
62
+ set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /IGNORE:4221")
60
63
 
61
64
  # /DYNAMICBASE - Address space load randomization (ASLR)
62
65
  # /NXCOMPAT - Data execution prevention (DEP)
@@ -6,7 +6,9 @@ if(USE_SSH STREQUAL "exec")
6
6
  elseif(USE_SSH STREQUAL ON OR USE_SSH STREQUAL "libssh2")
7
7
  find_pkglibraries(LIBSSH2 libssh2)
8
8
 
9
- if(NOT LIBSSH2_FOUND)
9
+ if(LIBSSH2_FOUND)
10
+ set(LIBSSH2_FOUND_PKGCONFIG 1)
11
+ else()
10
12
  find_package(LibSSH2)
11
13
  set(LIBSSH2_INCLUDE_DIRS ${LIBSSH2_INCLUDE_DIR})
12
14
  get_filename_component(LIBSSH2_LIBRARY_DIRS "${LIBSSH2_LIBRARY}" DIRECTORY)
@@ -20,7 +22,11 @@ elseif(USE_SSH STREQUAL ON OR USE_SSH STREQUAL "libssh2")
20
22
 
21
23
  list(APPEND LIBGIT2_SYSTEM_INCLUDES ${LIBSSH2_INCLUDE_DIRS})
22
24
  list(APPEND LIBGIT2_SYSTEM_LIBS ${LIBSSH2_LIBRARIES})
23
- list(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS})
25
+ if(LIBSSH2_FOUND_PKGCONFIG)
26
+ list(APPEND LIBGIT2_PC_REQUIRES "libssh2")
27
+ else()
28
+ list(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS})
29
+ endif()
24
30
 
25
31
  check_library_exists("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS)
26
32
  if(HAVE_LIBSSH2_MEMORY_CREDENTIALS)
@@ -42,5 +48,5 @@ elseif(USE_SSH STREQUAL ON OR USE_SSH STREQUAL "libssh2")
42
48
  elseif(USE_SSH STREQUAL OFF OR USE_SSH STREQUAL "")
43
49
  add_feature_info(SSH OFF "SSH transport support")
44
50
  else()
45
- message(FATAL_ERROR "unknown SSH option: ${USE_HTTP_PARSER}")
51
+ message(FATAL_ERROR "unknown SSH option: ${USE_SSH}")
46
52
  endif()