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.
- checksums.yaml +4 -4
- data/ext/rugged/extconf.rb +4 -4
- data/ext/rugged/rugged.c +12 -1
- data/ext/rugged/rugged_blame.c +22 -6
- data/ext/rugged/rugged_blob.c +24 -9
- data/ext/rugged/rugged_branch.c +10 -7
- data/ext/rugged/rugged_branch_collection.c +8 -6
- data/ext/rugged/rugged_commit.c +7 -6
- data/ext/rugged/rugged_config.c +20 -11
- data/ext/rugged/rugged_diff.c +26 -12
- data/ext/rugged/rugged_diff_hunk.c +2 -1
- data/ext/rugged/rugged_index.c +39 -29
- data/ext/rugged/rugged_note.c +7 -6
- data/ext/rugged/rugged_object.c +3 -2
- data/ext/rugged/rugged_patch.c +23 -9
- data/ext/rugged/rugged_rebase.c +22 -10
- data/ext/rugged/rugged_reference.c +22 -13
- data/ext/rugged/rugged_reference_collection.c +9 -7
- data/ext/rugged/rugged_remote.c +23 -12
- data/ext/rugged/rugged_remote_collection.c +11 -9
- data/ext/rugged/rugged_repo.c +60 -45
- data/ext/rugged/rugged_revwalk.c +22 -12
- data/ext/rugged/rugged_submodule.c +23 -20
- data/ext/rugged/rugged_submodule_collection.c +20 -9
- data/ext/rugged/rugged_tag.c +6 -4
- data/ext/rugged/rugged_tag_collection.c +7 -5
- data/ext/rugged/rugged_tree.c +27 -15
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +2 -0
- data/vendor/libgit2/CMakeLists.txt +1 -1
- data/vendor/libgit2/cmake/DefaultCFlags.cmake +4 -1
- data/vendor/libgit2/cmake/SelectSSH.cmake +9 -3
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +2 -3
- data/vendor/libgit2/deps/xdiff/CMakeLists.txt +1 -1
- data/vendor/libgit2/deps/xdiff/xmerge.c +14 -10
- data/vendor/libgit2/include/git2/deprecated.h +1 -1
- data/vendor/libgit2/include/git2/index.h +1 -1
- data/vendor/libgit2/include/git2/merge.h +4 -2
- data/vendor/libgit2/include/git2/oid.h +0 -1
- data/vendor/libgit2/include/git2/proxy.h +2 -3
- data/vendor/libgit2/include/git2/remote.h +19 -7
- data/vendor/libgit2/include/git2/stdint.h +1 -1
- data/vendor/libgit2/include/git2/sys/transport.h +1 -1
- data/vendor/libgit2/include/git2/version.h +4 -2
- data/vendor/libgit2/src/cli/CMakeLists.txt +1 -2
- data/vendor/libgit2/src/cli/opt.c +3 -3
- data/vendor/libgit2/src/cli/opt_usage.c +1 -1
- data/vendor/libgit2/src/libgit2/CMakeLists.txt +32 -16
- data/vendor/libgit2/src/libgit2/attr_file.c +10 -3
- data/vendor/libgit2/src/libgit2/clone.c +6 -0
- data/vendor/libgit2/src/libgit2/commit.c +1 -1
- data/vendor/libgit2/src/libgit2/commit_graph.c +1 -2
- data/vendor/libgit2/src/libgit2/config.c +1 -1
- data/vendor/libgit2/src/libgit2/config_file.c +2 -1
- data/vendor/libgit2/src/libgit2/config_mem.c +1 -0
- data/vendor/libgit2/src/libgit2/config_parse.c +2 -1
- data/vendor/libgit2/src/libgit2/delta.c +5 -1
- data/vendor/libgit2/src/libgit2/diff_driver.c +1 -1
- data/vendor/libgit2/src/libgit2/diff_stats.c +19 -12
- data/vendor/libgit2/src/libgit2/fetchhead.c +1 -1
- data/vendor/libgit2/src/libgit2/index.c +8 -8
- data/vendor/libgit2/src/libgit2/index.h +3 -0
- data/vendor/libgit2/src/libgit2/indexer.c +2 -2
- data/vendor/libgit2/src/libgit2/merge.c +1 -1
- data/vendor/libgit2/src/libgit2/merge.h +4 -0
- data/vendor/libgit2/src/libgit2/merge_file.c +43 -30
- data/vendor/libgit2/src/libgit2/message.c +1 -1
- data/vendor/libgit2/src/libgit2/midx.c +2 -3
- data/vendor/libgit2/src/libgit2/odb.c +2 -6
- data/vendor/libgit2/src/libgit2/odb_loose.c +24 -14
- data/vendor/libgit2/src/libgit2/oid.c +4 -5
- data/vendor/libgit2/src/libgit2/pack-objects.c +2 -4
- data/vendor/libgit2/src/libgit2/pack.c +3 -0
- data/vendor/libgit2/src/libgit2/refs.c +15 -6
- data/vendor/libgit2/src/libgit2/remote.c +4 -1
- data/vendor/libgit2/src/libgit2/remote.h +0 -1
- data/vendor/libgit2/src/libgit2/repository.c +5 -4
- data/vendor/libgit2/src/libgit2/streams/socket.c +30 -0
- data/vendor/libgit2/src/libgit2/submodule.c +12 -5
- data/vendor/libgit2/src/libgit2/tag.c +3 -1
- data/vendor/libgit2/src/libgit2/transports/auth_sspi.c +2 -0
- data/vendor/libgit2/src/libgit2/transports/credential.c +1 -1
- data/vendor/libgit2/src/libgit2/transports/git.c +1 -1
- data/vendor/libgit2/src/libgit2/transports/httpclient.c +12 -9
- data/vendor/libgit2/src/libgit2/transports/local.c +8 -1
- data/vendor/libgit2/src/libgit2/transports/smart.c +5 -5
- data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +3 -3
- data/vendor/libgit2/src/libgit2/transports/ssh_exec.c +57 -18
- data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.c +3 -3
- data/vendor/libgit2/src/util/CMakeLists.txt +3 -4
- data/vendor/libgit2/src/util/fs_path.c +66 -6
- data/vendor/libgit2/src/util/fs_path.h +6 -0
- data/vendor/libgit2/src/util/futils.h +11 -3
- data/vendor/libgit2/src/util/hash/builtin.c +14 -4
- data/vendor/libgit2/src/util/hash/openssl.c +0 -4
- data/vendor/libgit2/src/util/hash/rfc6234/sha224-256.c +8 -6
- data/vendor/libgit2/src/util/hashmap.h +1 -0
- data/vendor/libgit2/src/util/net.c +5 -5
- data/vendor/libgit2/src/util/process.h +2 -1
- data/vendor/libgit2/src/util/runtime.c +2 -2
- data/vendor/libgit2/src/util/str.c +18 -6
- data/vendor/libgit2/src/util/str.h +5 -3
- data/vendor/libgit2/src/util/unix/process.c +92 -15
- data/vendor/libgit2/src/util/util.c +16 -3
- data/vendor/libgit2/src/util/util.h +1 -0
- data/vendor/libgit2/src/util/win32/path_w32.c +81 -5
- data/vendor/libgit2/src/util/win32/process.c +22 -6
- metadata +17 -6
data/ext/rugged/rugged_index.c
CHANGED
|
@@ -14,6 +14,7 @@ extern VALUE rb_cRuggedDiff;
|
|
|
14
14
|
extern VALUE rb_cRuggedTree;
|
|
15
15
|
|
|
16
16
|
extern const rb_data_type_t rugged_object_type;
|
|
17
|
+
extern const rb_data_type_t rugged_repository_type;
|
|
17
18
|
|
|
18
19
|
static void rb_git_indexentry_toC(git_index_entry *entry, VALUE rb_entry);
|
|
19
20
|
static VALUE rb_git_indexentry_fromC(const git_index_entry *entry);
|
|
@@ -22,14 +23,23 @@ static VALUE rb_git_indexentry_fromC(const git_index_entry *entry);
|
|
|
22
23
|
* Index
|
|
23
24
|
*/
|
|
24
25
|
|
|
25
|
-
static void rb_git_index__free(
|
|
26
|
+
static void rb_git_index__free(void *data)
|
|
26
27
|
{
|
|
28
|
+
git_index *index = (git_index *) data;
|
|
27
29
|
git_index_free(index);
|
|
28
30
|
}
|
|
29
31
|
|
|
32
|
+
const rb_data_type_t rugged_index_type = {
|
|
33
|
+
.wrap_struct_name = "Rugged::Index",
|
|
34
|
+
.function = {
|
|
35
|
+
.dfree = rb_git_index__free,
|
|
36
|
+
},
|
|
37
|
+
.flags = RUBY_TYPED_FREE_IMMEDIATELY,
|
|
38
|
+
};
|
|
39
|
+
|
|
30
40
|
VALUE rugged_index_new(VALUE klass, VALUE owner, git_index *index)
|
|
31
41
|
{
|
|
32
|
-
VALUE rb_index =
|
|
42
|
+
VALUE rb_index = TypedData_Wrap_Struct(klass, &rugged_index_type, index);
|
|
33
43
|
rugged_set_owner(rb_index, owner);
|
|
34
44
|
return rb_index;
|
|
35
45
|
}
|
|
@@ -72,7 +82,7 @@ static VALUE rb_git_index_new(int argc, VALUE *argv, VALUE klass)
|
|
|
72
82
|
static VALUE rb_git_index_clear(VALUE self)
|
|
73
83
|
{
|
|
74
84
|
git_index *index;
|
|
75
|
-
|
|
85
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
76
86
|
git_index_clear(index);
|
|
77
87
|
return Qnil;
|
|
78
88
|
}
|
|
@@ -89,7 +99,7 @@ static VALUE rb_git_index_read(VALUE self)
|
|
|
89
99
|
git_index *index;
|
|
90
100
|
int error;
|
|
91
101
|
|
|
92
|
-
|
|
102
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
93
103
|
|
|
94
104
|
error = git_index_read(index, 0);
|
|
95
105
|
rugged_exception_check(error);
|
|
@@ -108,7 +118,7 @@ static VALUE rb_git_index_write(VALUE self)
|
|
|
108
118
|
git_index *index;
|
|
109
119
|
int error;
|
|
110
120
|
|
|
111
|
-
|
|
121
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
112
122
|
|
|
113
123
|
error = git_index_write(index);
|
|
114
124
|
rugged_exception_check(error);
|
|
@@ -125,7 +135,7 @@ static VALUE rb_git_index_write(VALUE self)
|
|
|
125
135
|
static VALUE rb_git_index_count(VALUE self)
|
|
126
136
|
{
|
|
127
137
|
git_index *index;
|
|
128
|
-
|
|
138
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
129
139
|
return INT2FIX(git_index_entrycount(index));
|
|
130
140
|
}
|
|
131
141
|
|
|
@@ -148,7 +158,7 @@ static VALUE rb_git_index_get(int argc, VALUE *argv, VALUE self)
|
|
|
148
158
|
|
|
149
159
|
VALUE rb_entry, rb_stage;
|
|
150
160
|
|
|
151
|
-
|
|
161
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
152
162
|
|
|
153
163
|
rb_scan_args(argc, argv, "11", &rb_entry, &rb_stage);
|
|
154
164
|
|
|
@@ -193,7 +203,7 @@ static VALUE rb_git_index_each(VALUE self)
|
|
|
193
203
|
unsigned int i, count;
|
|
194
204
|
|
|
195
205
|
RETURN_ENUMERATOR(self, 0, 0);
|
|
196
|
-
|
|
206
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
197
207
|
|
|
198
208
|
count = (unsigned int)git_index_entrycount(index);
|
|
199
209
|
for (i = 0; i < count; ++i) {
|
|
@@ -219,7 +229,7 @@ static VALUE rb_git_index_remove(int argc, VALUE *argv, VALUE self)
|
|
|
219
229
|
|
|
220
230
|
VALUE rb_entry, rb_stage;
|
|
221
231
|
|
|
222
|
-
|
|
232
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
223
233
|
|
|
224
234
|
if (rb_scan_args(argc, argv, "11", &rb_entry, &rb_stage) > 1) {
|
|
225
235
|
Check_Type(rb_stage, T_FIXNUM);
|
|
@@ -248,7 +258,7 @@ static VALUE rb_git_index_remove_directory(int argc, VALUE *argv, VALUE self)
|
|
|
248
258
|
|
|
249
259
|
VALUE rb_dir, rb_stage;
|
|
250
260
|
|
|
251
|
-
|
|
261
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
252
262
|
|
|
253
263
|
if (rb_scan_args(argc, argv, "11", &rb_dir, &rb_stage) > 1) {
|
|
254
264
|
Check_Type(rb_stage, T_FIXNUM);
|
|
@@ -292,7 +302,7 @@ static VALUE rb_git_index_add(VALUE self, VALUE rb_entry)
|
|
|
292
302
|
git_index *index;
|
|
293
303
|
int error = 0;
|
|
294
304
|
|
|
295
|
-
|
|
305
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
296
306
|
|
|
297
307
|
if (TYPE(rb_entry) == T_HASH) {
|
|
298
308
|
git_index_entry entry;
|
|
@@ -378,7 +388,7 @@ static VALUE rb_git_index_add_all(int argc, VALUE *argv, VALUE self)
|
|
|
378
388
|
int error, exception = 0;
|
|
379
389
|
unsigned int flags = GIT_INDEX_ADD_DEFAULT;
|
|
380
390
|
|
|
381
|
-
|
|
391
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
382
392
|
|
|
383
393
|
if (rb_scan_args(argc, argv, "02", &rb_pathspecs, &rb_options) > 1) {
|
|
384
394
|
Check_Type(rb_options, T_HASH);
|
|
@@ -439,7 +449,7 @@ static VALUE rb_git_index_update_all(int argc, VALUE *argv, VALUE self)
|
|
|
439
449
|
git_strarray pathspecs;
|
|
440
450
|
int error, exception = 0;
|
|
441
451
|
|
|
442
|
-
|
|
452
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
443
453
|
|
|
444
454
|
rb_scan_args(argc, argv, "01", &rb_pathspecs);
|
|
445
455
|
|
|
@@ -482,7 +492,7 @@ static VALUE rb_git_index_remove_all(int argc, VALUE *argv, VALUE self)
|
|
|
482
492
|
git_strarray pathspecs;
|
|
483
493
|
int error, exception = 0;
|
|
484
494
|
|
|
485
|
-
|
|
495
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
486
496
|
|
|
487
497
|
rb_scan_args(argc, argv, "01", &rb_pathspecs);
|
|
488
498
|
|
|
@@ -628,12 +638,12 @@ static VALUE rb_git_index_writetree(int argc, VALUE *argv, VALUE self)
|
|
|
628
638
|
int error;
|
|
629
639
|
VALUE rb_repo;
|
|
630
640
|
|
|
631
|
-
|
|
641
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
632
642
|
|
|
633
643
|
if (rb_scan_args(argc, argv, "01", &rb_repo) == 1) {
|
|
634
644
|
git_repository *repo = NULL;
|
|
635
645
|
rugged_check_repo(rb_repo);
|
|
636
|
-
|
|
646
|
+
TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
|
|
637
647
|
error = git_index_write_tree_to(&tree_oid, index, repo);
|
|
638
648
|
}
|
|
639
649
|
else {
|
|
@@ -659,7 +669,7 @@ static VALUE rb_git_index_readtree(VALUE self, VALUE rb_tree)
|
|
|
659
669
|
git_tree *tree;
|
|
660
670
|
int error;
|
|
661
671
|
|
|
662
|
-
|
|
672
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
663
673
|
TypedData_Get_Struct(rb_tree, git_tree, &rugged_object_type, tree);
|
|
664
674
|
|
|
665
675
|
if (!rb_obj_is_kind_of(rb_tree, rb_cRuggedTree)) {
|
|
@@ -684,9 +694,9 @@ static VALUE rb_git_diff_tree_to_index(VALUE self, VALUE rb_other, VALUE rb_opti
|
|
|
684
694
|
|
|
685
695
|
rugged_parse_diff_options(&opts, rb_options);
|
|
686
696
|
|
|
687
|
-
|
|
697
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
688
698
|
owner = rugged_owner(self);
|
|
689
|
-
|
|
699
|
+
TypedData_Get_Struct(owner, git_repository, &rugged_repository_type, repo);
|
|
690
700
|
|
|
691
701
|
// Need to flip the reverse option, so that the index is by default
|
|
692
702
|
// the "old file" side of the diff.
|
|
@@ -712,9 +722,9 @@ static VALUE rb_git_diff_index_to_workdir(VALUE self, VALUE rb_options)
|
|
|
712
722
|
|
|
713
723
|
rugged_parse_diff_options(&opts, rb_options);
|
|
714
724
|
|
|
715
|
-
|
|
725
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
716
726
|
owner = rugged_owner(self);
|
|
717
|
-
|
|
727
|
+
TypedData_Get_Struct(owner, git_repository, &rugged_repository_type, repo);
|
|
718
728
|
|
|
719
729
|
error = git_diff_index_to_workdir(&diff, repo, index, &opts);
|
|
720
730
|
|
|
@@ -733,7 +743,7 @@ static VALUE rb_git_diff_index_to_workdir(VALUE self, VALUE rb_options)
|
|
|
733
743
|
static VALUE rb_git_index_conflicts_p(VALUE self)
|
|
734
744
|
{
|
|
735
745
|
git_index *index;
|
|
736
|
-
|
|
746
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
737
747
|
return git_index_has_conflicts(index) ? Qtrue : Qfalse;
|
|
738
748
|
}
|
|
739
749
|
|
|
@@ -770,7 +780,7 @@ static VALUE rb_git_conflict_add(VALUE self, VALUE rb_conflict)
|
|
|
770
780
|
if (!NIL_P(rb_theirs))
|
|
771
781
|
rb_git_indexentry_toC(&theirs, rb_theirs);
|
|
772
782
|
|
|
773
|
-
|
|
783
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
774
784
|
|
|
775
785
|
error = git_index_conflict_add(index,
|
|
776
786
|
NIL_P(rb_ancestor) ? NULL : &ancestor,
|
|
@@ -794,7 +804,7 @@ static VALUE rb_git_conflict_remove(VALUE self, VALUE rb_path)
|
|
|
794
804
|
|
|
795
805
|
Check_Type(rb_path, T_STRING);
|
|
796
806
|
|
|
797
|
-
|
|
807
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
798
808
|
|
|
799
809
|
error = git_index_conflict_remove(index, StringValueCStr(rb_path));
|
|
800
810
|
rugged_exception_check(error);
|
|
@@ -823,7 +833,7 @@ static VALUE rb_git_conflict_get(VALUE self, VALUE rb_path)
|
|
|
823
833
|
|
|
824
834
|
Check_Type(rb_path, T_STRING);
|
|
825
835
|
|
|
826
|
-
|
|
836
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
827
837
|
|
|
828
838
|
error = git_index_conflict_get(&ancestor, &ours, &theirs, index, StringValueCStr(rb_path));
|
|
829
839
|
if (error == GIT_ENOTFOUND)
|
|
@@ -894,10 +904,10 @@ static VALUE rb_git_merge_file(int argc, VALUE *argv, VALUE self)
|
|
|
894
904
|
|
|
895
905
|
Check_Type(rb_path, T_STRING);
|
|
896
906
|
|
|
897
|
-
|
|
907
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
898
908
|
|
|
899
909
|
rugged_check_repo(rb_repo);
|
|
900
|
-
|
|
910
|
+
TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
|
|
901
911
|
|
|
902
912
|
error = git_index_conflict_get(&ancestor, &ours, &theirs, index, StringValueCStr(rb_path));
|
|
903
913
|
if (error == GIT_ENOTFOUND)
|
|
@@ -930,7 +940,7 @@ static VALUE rb_git_conflict_cleanup(VALUE self)
|
|
|
930
940
|
{
|
|
931
941
|
git_index *index;
|
|
932
942
|
|
|
933
|
-
|
|
943
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
934
944
|
git_index_conflict_cleanup(index);
|
|
935
945
|
|
|
936
946
|
return Qnil;
|
|
@@ -956,7 +966,7 @@ static VALUE rb_git_index_conflicts(VALUE self)
|
|
|
956
966
|
const git_index_entry *ancestor, *ours, *theirs;
|
|
957
967
|
int error;
|
|
958
968
|
|
|
959
|
-
|
|
969
|
+
TypedData_Get_Struct(self, git_index, &rugged_index_type, index);
|
|
960
970
|
|
|
961
971
|
error = git_index_conflict_iterator_new(&iter, index);
|
|
962
972
|
rugged_exception_check(error);
|
data/ext/rugged/rugged_note.c
CHANGED
|
@@ -11,6 +11,7 @@ extern VALUE rb_cRuggedRepo;
|
|
|
11
11
|
extern VALUE rb_cRuggedObject;
|
|
12
12
|
|
|
13
13
|
extern const rb_data_type_t rugged_object_type;
|
|
14
|
+
extern const rb_data_type_t rugged_repository_type;
|
|
14
15
|
|
|
15
16
|
static VALUE rugged_git_note_message(const git_note *note)
|
|
16
17
|
{
|
|
@@ -64,7 +65,7 @@ static VALUE rb_git_note_lookup(int argc, VALUE *argv, VALUE self)
|
|
|
64
65
|
TypedData_Get_Struct(self, git_object, &rugged_object_type, object);
|
|
65
66
|
|
|
66
67
|
owner = rugged_owner(self);
|
|
67
|
-
|
|
68
|
+
TypedData_Get_Struct(owner, git_repository, &rugged_repository_type, repo);
|
|
68
69
|
|
|
69
70
|
error = git_note_read(¬e, repo, notes_ref, git_object_id(object));
|
|
70
71
|
|
|
@@ -129,7 +130,7 @@ static VALUE rb_git_note_create(VALUE self, VALUE rb_data)
|
|
|
129
130
|
TypedData_Get_Struct(self, git_object, &rugged_object_type, target);
|
|
130
131
|
|
|
131
132
|
owner = rugged_owner(self);
|
|
132
|
-
|
|
133
|
+
TypedData_Get_Struct(owner, git_repository, &rugged_repository_type, repo);
|
|
133
134
|
|
|
134
135
|
rb_ref = rb_hash_aref(rb_data, CSTR2SYM("ref"));
|
|
135
136
|
|
|
@@ -212,7 +213,7 @@ static VALUE rb_git_note_remove(int argc, VALUE *argv, VALUE self)
|
|
|
212
213
|
TypedData_Get_Struct(self, git_object, &rugged_object_type, target);
|
|
213
214
|
|
|
214
215
|
owner = rugged_owner(self);
|
|
215
|
-
|
|
216
|
+
TypedData_Get_Struct(owner, git_repository, &rugged_repository_type, repo);
|
|
216
217
|
|
|
217
218
|
rb_scan_args(argc, argv, "01", &rb_data);
|
|
218
219
|
|
|
@@ -259,7 +260,7 @@ static int cb_note__each(const git_oid *blob_id, const git_oid *annotated_object
|
|
|
259
260
|
|
|
260
261
|
git_repository *repo;
|
|
261
262
|
|
|
262
|
-
|
|
263
|
+
TypedData_Get_Struct(payload->rb_data, git_repository, &rugged_repository_type, repo);
|
|
263
264
|
|
|
264
265
|
rugged_exception_check(
|
|
265
266
|
git_object_lookup(&annotated_object, repo, annotated_object_id, GIT_OBJ_ANY)
|
|
@@ -307,7 +308,7 @@ static VALUE rb_git_note_each(int argc, VALUE *argv, VALUE self)
|
|
|
307
308
|
notes_ref = StringValueCStr(rb_notes_ref);
|
|
308
309
|
}
|
|
309
310
|
|
|
310
|
-
|
|
311
|
+
TypedData_Get_Struct(self, git_repository, &rugged_repository_type, repo);
|
|
311
312
|
|
|
312
313
|
error = git_note_foreach(repo, notes_ref, &cb_note__each, &payload);
|
|
313
314
|
|
|
@@ -334,7 +335,7 @@ static VALUE rb_git_note_default_ref_GET(VALUE self)
|
|
|
334
335
|
git_buf ref_name = { 0 };
|
|
335
336
|
VALUE rb_result;
|
|
336
337
|
|
|
337
|
-
|
|
338
|
+
TypedData_Get_Struct(self, git_repository, &rugged_repository_type, repo);
|
|
338
339
|
|
|
339
340
|
rugged_exception_check(
|
|
340
341
|
git_note_default_ref(&ref_name, repo)
|
data/ext/rugged/rugged_object.c
CHANGED
|
@@ -17,6 +17,7 @@ extern VALUE rb_cRuggedRepo;
|
|
|
17
17
|
VALUE rb_cRuggedObject;
|
|
18
18
|
|
|
19
19
|
const rb_data_type_t rugged_object_type;
|
|
20
|
+
extern const rb_data_type_t rugged_repository_type;
|
|
20
21
|
|
|
21
22
|
git_otype rugged_otype_get(VALUE self)
|
|
22
23
|
{
|
|
@@ -267,7 +268,7 @@ VALUE rb_git_object_lookup(VALUE klass, VALUE rb_repo, VALUE rb_hex)
|
|
|
267
268
|
if (oid_length > GIT_OID_HEXSZ)
|
|
268
269
|
rb_raise(rb_eTypeError, "The given OID is too long");
|
|
269
270
|
|
|
270
|
-
|
|
271
|
+
TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
|
|
271
272
|
|
|
272
273
|
error = git_oid_fromstrn(&oid, RSTRING_PTR(rb_hex), oid_length);
|
|
273
274
|
rugged_exception_check(error);
|
|
@@ -295,7 +296,7 @@ VALUE rugged_object_rev_parse(VALUE rb_repo, VALUE rb_spec, int as_obj)
|
|
|
295
296
|
|
|
296
297
|
rugged_check_repo(rb_repo);
|
|
297
298
|
|
|
298
|
-
|
|
299
|
+
TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
|
|
299
300
|
|
|
300
301
|
error = git_revparse_single(&object, repo, spec);
|
|
301
302
|
rugged_exception_check(error);
|
data/ext/rugged/rugged_patch.c
CHANGED
|
@@ -69,9 +69,23 @@ VALUE rb_git_patch_from_strings(int argc, VALUE *argv, VALUE self)
|
|
|
69
69
|
return rugged_patch_new(self, patch);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
static void rb_git_patch__free(void *data)
|
|
73
|
+
{
|
|
74
|
+
git_patch *patch = (git_patch *) data;
|
|
75
|
+
git_patch_free(patch);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const rb_data_type_t rugged_patch_type = {
|
|
79
|
+
.wrap_struct_name = "Rugged::Patch",
|
|
80
|
+
.function = {
|
|
81
|
+
.dfree = rb_git_patch__free,
|
|
82
|
+
},
|
|
83
|
+
.flags = RUBY_TYPED_FREE_IMMEDIATELY,
|
|
84
|
+
};
|
|
85
|
+
|
|
72
86
|
VALUE rugged_patch_new(VALUE owner, git_patch *patch)
|
|
73
87
|
{
|
|
74
|
-
VALUE rb_patch =
|
|
88
|
+
VALUE rb_patch = TypedData_Wrap_Struct(rb_cRuggedPatch, &rugged_patch_type, patch);
|
|
75
89
|
rugged_set_owner(rb_patch, owner);
|
|
76
90
|
return rb_patch;
|
|
77
91
|
}
|
|
@@ -94,7 +108,7 @@ static VALUE rb_git_diff_patch_each_hunk(VALUE self)
|
|
|
94
108
|
size_t hunks_count, h;
|
|
95
109
|
|
|
96
110
|
RETURN_ENUMERATOR(self, 0, 0);
|
|
97
|
-
|
|
111
|
+
TypedData_Get_Struct(self, git_patch, &rugged_patch_type, patch);
|
|
98
112
|
|
|
99
113
|
hunks_count = git_patch_num_hunks(patch);
|
|
100
114
|
for (h = 0; h < hunks_count; ++h) {
|
|
@@ -117,7 +131,7 @@ static VALUE rb_git_diff_patch_each_hunk(VALUE self)
|
|
|
117
131
|
static VALUE rb_git_diff_patch_hunk_count(VALUE self)
|
|
118
132
|
{
|
|
119
133
|
git_patch *patch;
|
|
120
|
-
|
|
134
|
+
TypedData_Get_Struct(self, git_patch, &rugged_patch_type, patch);
|
|
121
135
|
|
|
122
136
|
return INT2FIX(git_patch_num_hunks(patch));
|
|
123
137
|
}
|
|
@@ -131,7 +145,7 @@ static VALUE rb_git_diff_patch_hunk_count(VALUE self)
|
|
|
131
145
|
static VALUE rb_git_diff_patch_delta(VALUE self)
|
|
132
146
|
{
|
|
133
147
|
git_patch *patch;
|
|
134
|
-
|
|
148
|
+
TypedData_Get_Struct(self, git_patch, &rugged_patch_type, patch);
|
|
135
149
|
|
|
136
150
|
return rugged_diff_delta_new(rugged_owner(self), git_patch_get_delta(patch));
|
|
137
151
|
}
|
|
@@ -146,7 +160,7 @@ static VALUE rb_git_diff_patch_stat(VALUE self)
|
|
|
146
160
|
{
|
|
147
161
|
git_patch *patch;
|
|
148
162
|
size_t additions, deletions;
|
|
149
|
-
|
|
163
|
+
TypedData_Get_Struct(self, git_patch, &rugged_patch_type, patch);
|
|
150
164
|
|
|
151
165
|
git_patch_line_stats(NULL, &additions, &deletions, patch);
|
|
152
166
|
|
|
@@ -191,7 +205,7 @@ static VALUE rb_git_diff_patch_lines(int argc, VALUE *argv, VALUE self)
|
|
|
191
205
|
size_t lines = 0;
|
|
192
206
|
int options = 0;
|
|
193
207
|
VALUE rb_options;
|
|
194
|
-
|
|
208
|
+
TypedData_Get_Struct(self, git_patch, &rugged_patch_type, patch);
|
|
195
209
|
|
|
196
210
|
rb_scan_args(argc, argv, "0:", &rb_options);
|
|
197
211
|
if (!NIL_P(rb_options)) {
|
|
@@ -282,7 +296,7 @@ static VALUE rb_git_diff_patch_bytesize(int argc, VALUE *argv, VALUE self)
|
|
|
282
296
|
size_t bytesize;
|
|
283
297
|
VALUE rb_options;
|
|
284
298
|
int include_context, include_hunk_headers, include_file_headers;
|
|
285
|
-
|
|
299
|
+
TypedData_Get_Struct(self, git_patch, &rugged_patch_type, patch);
|
|
286
300
|
|
|
287
301
|
include_context = include_hunk_headers = include_file_headers = 1;
|
|
288
302
|
|
|
@@ -352,7 +366,7 @@ static VALUE rb_git_diff_patch_to_s(VALUE self)
|
|
|
352
366
|
{
|
|
353
367
|
git_patch *patch;
|
|
354
368
|
VALUE rb_buffer = rb_ary_new();
|
|
355
|
-
|
|
369
|
+
TypedData_Get_Struct(self, git_patch, &rugged_patch_type, patch);
|
|
356
370
|
|
|
357
371
|
rugged_exception_check(git_patch_print(patch, patch_print_cb, (void*)rb_buffer));
|
|
358
372
|
|
|
@@ -370,7 +384,7 @@ static VALUE rb_git_diff_patch_header(VALUE self)
|
|
|
370
384
|
git_patch *patch;
|
|
371
385
|
int error = 0;
|
|
372
386
|
VALUE rb_buffer = rb_ary_new();
|
|
373
|
-
|
|
387
|
+
TypedData_Get_Struct(self, git_patch, &rugged_patch_type, patch);
|
|
374
388
|
|
|
375
389
|
error = git_patch_print(patch, patch_print_header_cb, (void*)rb_buffer);
|
|
376
390
|
if (error && error != GIT_ITEROVER)
|
data/ext/rugged/rugged_rebase.c
CHANGED
|
@@ -16,6 +16,8 @@ extern VALUE rb_cRuggedReference;
|
|
|
16
16
|
VALUE rb_cRuggedRebase;
|
|
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
|
static VALUE rebase_operation_type(git_rebase_operation *operation);
|
|
21
23
|
|
|
@@ -42,14 +44,24 @@ static void parse_rebase_options(git_rebase_options *ret, VALUE rb_options)
|
|
|
42
44
|
rugged_parse_merge_options(&ret->merge_options, rb_options);
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
void rb_git_rebase__free(
|
|
47
|
+
static void rb_git_rebase__free(void *data)
|
|
46
48
|
{
|
|
49
|
+
git_rebase *rebase = (git_rebase *) data;
|
|
47
50
|
git_rebase_free(rebase);
|
|
48
51
|
}
|
|
49
52
|
|
|
53
|
+
const rb_data_type_t rugged_rebase_type = {
|
|
54
|
+
.wrap_struct_name = "Rugged::Rebase",
|
|
55
|
+
.function = {
|
|
56
|
+
.dfree = rb_git_rebase__free,
|
|
57
|
+
},
|
|
58
|
+
.flags = RUBY_TYPED_FREE_IMMEDIATELY,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
|
|
50
62
|
VALUE rugged_rebase_new(VALUE klass, VALUE owner, git_rebase *rebase)
|
|
51
63
|
{
|
|
52
|
-
VALUE rb_rebase =
|
|
64
|
+
VALUE rb_rebase = TypedData_Wrap_Struct(klass, &rugged_rebase_type, rebase);
|
|
53
65
|
rugged_set_owner(rb_rebase, owner);
|
|
54
66
|
return rb_rebase;
|
|
55
67
|
}
|
|
@@ -66,7 +78,7 @@ static void get_annotated_commit(git_annotated_commit **annotated_commit, VALUE
|
|
|
66
78
|
int error;
|
|
67
79
|
|
|
68
80
|
rugged_check_repo(rb_repo);
|
|
69
|
-
|
|
81
|
+
TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
|
|
70
82
|
|
|
71
83
|
if (rb_obj_is_kind_of(rb_value, rb_cRuggedCommit)) {
|
|
72
84
|
const git_commit * commit;
|
|
@@ -79,7 +91,7 @@ static void get_annotated_commit(git_annotated_commit **annotated_commit, VALUE
|
|
|
79
91
|
} else if (rb_obj_is_kind_of(rb_value, rb_cRuggedReference)) {
|
|
80
92
|
const git_reference * ref;
|
|
81
93
|
|
|
82
|
-
|
|
94
|
+
TypedData_Get_Struct(rb_value, git_reference, &rugged_reference_type, ref);
|
|
83
95
|
|
|
84
96
|
error = git_annotated_commit_from_ref(annotated_commit, repo, ref);
|
|
85
97
|
} else if (TYPE(rb_value) == T_STRING) {
|
|
@@ -152,7 +164,7 @@ static VALUE rb_git_rebase_new(int argc, VALUE* argv, VALUE klass)
|
|
|
152
164
|
git_rebase_options options = GIT_REBASE_OPTIONS_INIT;
|
|
153
165
|
|
|
154
166
|
rb_scan_args(argc, argv, "31:", &rb_repo, &rb_branch, &rb_upstream, &rb_onto, &rb_options);
|
|
155
|
-
|
|
167
|
+
TypedData_Get_Struct(rb_repo, git_repository, &rugged_repository_type, repo);
|
|
156
168
|
|
|
157
169
|
if ((exception = rugged_get_annotated_commit(&branch, rb_repo, rb_branch)))
|
|
158
170
|
goto cleanup;
|
|
@@ -209,7 +221,7 @@ static VALUE rb_git_rebase_next(VALUE self)
|
|
|
209
221
|
git_rebase_operation *operation;
|
|
210
222
|
VALUE hash, val;
|
|
211
223
|
|
|
212
|
-
|
|
224
|
+
TypedData_Get_Struct(self, git_rebase, &rugged_rebase_type, rebase);
|
|
213
225
|
error = git_rebase_next(&operation, rebase);
|
|
214
226
|
if (error == GIT_ITEROVER)
|
|
215
227
|
return Qnil;
|
|
@@ -252,7 +264,7 @@ static VALUE rb_git_rebase_inmemory_index(VALUE self)
|
|
|
252
264
|
git_rebase *rebase;
|
|
253
265
|
git_index *index;
|
|
254
266
|
|
|
255
|
-
|
|
267
|
+
TypedData_Get_Struct(self, git_rebase, &rugged_rebase_type, rebase);
|
|
256
268
|
rugged_exception_check(git_rebase_inmemory_index(&index, rebase));
|
|
257
269
|
|
|
258
270
|
return rugged_index_new(rb_cRuggedIndex, self, index);
|
|
@@ -279,7 +291,7 @@ static VALUE rb_git_rebase_commit(int argc, VALUE *argv, VALUE self)
|
|
|
279
291
|
const char *message = NULL;
|
|
280
292
|
VALUE rb_options, rb_author, rb_committer, rb_message;
|
|
281
293
|
|
|
282
|
-
|
|
294
|
+
TypedData_Get_Struct(self, git_rebase, &rugged_rebase_type, rebase);
|
|
283
295
|
rb_scan_args(argc, argv, ":", &rb_options);
|
|
284
296
|
|
|
285
297
|
Check_Type(rb_options, T_HASH);
|
|
@@ -326,7 +338,7 @@ static VALUE rb_git_rebase_abort(VALUE self)
|
|
|
326
338
|
{
|
|
327
339
|
git_rebase *rebase;
|
|
328
340
|
|
|
329
|
-
|
|
341
|
+
TypedData_Get_Struct(self, git_rebase, &rugged_rebase_type, rebase);
|
|
330
342
|
rugged_exception_check(git_rebase_abort(rebase));
|
|
331
343
|
|
|
332
344
|
return Qnil;
|
|
@@ -345,7 +357,7 @@ static VALUE rb_git_rebase_finish(VALUE self, VALUE rb_sig)
|
|
|
345
357
|
git_signature *sig;
|
|
346
358
|
int error;
|
|
347
359
|
|
|
348
|
-
|
|
360
|
+
TypedData_Get_Struct(self, git_rebase, &rugged_rebase_type, rebase);
|
|
349
361
|
sig = rugged_signature_get(rb_sig, NULL);
|
|
350
362
|
error = git_rebase_finish(rebase, sig);
|
|
351
363
|
git_signature_free(sig);
|
|
@@ -12,14 +12,23 @@ extern VALUE rb_cRuggedRepo;
|
|
|
12
12
|
|
|
13
13
|
VALUE rb_cRuggedReference;
|
|
14
14
|
|
|
15
|
-
void rb_git_ref__free(
|
|
15
|
+
void rb_git_ref__free(void *data)
|
|
16
16
|
{
|
|
17
|
+
git_reference *ref = (git_reference *) data;
|
|
17
18
|
git_reference_free(ref);
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
const rb_data_type_t rugged_reference_type = {
|
|
22
|
+
.wrap_struct_name = "Rugged::Reference",
|
|
23
|
+
.function = {
|
|
24
|
+
.dfree = rb_git_ref__free,
|
|
25
|
+
},
|
|
26
|
+
.flags = RUBY_TYPED_FREE_IMMEDIATELY,
|
|
27
|
+
};
|
|
28
|
+
|
|
20
29
|
VALUE rugged_ref_new(VALUE klass, VALUE owner, git_reference *ref)
|
|
21
30
|
{
|
|
22
|
-
VALUE rb_ref =
|
|
31
|
+
VALUE rb_ref = TypedData_Wrap_Struct(klass, &rugged_reference_type, ref);
|
|
23
32
|
rugged_set_owner(rb_ref, owner);
|
|
24
33
|
return rb_ref;
|
|
25
34
|
}
|
|
@@ -73,7 +82,7 @@ static VALUE rb_git_ref_peel(VALUE self)
|
|
|
73
82
|
char oid[GIT_OID_HEXSZ + 1];
|
|
74
83
|
int error;
|
|
75
84
|
|
|
76
|
-
|
|
85
|
+
TypedData_Get_Struct(self, git_reference, &rugged_reference_type, ref);
|
|
77
86
|
|
|
78
87
|
error = git_reference_peel(&object, ref, GIT_OBJ_ANY);
|
|
79
88
|
if (error == GIT_ENOTFOUND)
|
|
@@ -114,7 +123,7 @@ static VALUE rb_git_ref_target(VALUE self)
|
|
|
114
123
|
{
|
|
115
124
|
git_reference *ref;
|
|
116
125
|
|
|
117
|
-
|
|
126
|
+
TypedData_Get_Struct(self, git_reference, &rugged_reference_type, ref);
|
|
118
127
|
|
|
119
128
|
if (git_reference_type(ref) == GIT_REF_OID) {
|
|
120
129
|
git_object *target;
|
|
@@ -155,7 +164,7 @@ static VALUE rb_git_ref_target(VALUE self)
|
|
|
155
164
|
static VALUE rb_git_ref_target_id(VALUE self)
|
|
156
165
|
{
|
|
157
166
|
git_reference *ref;
|
|
158
|
-
|
|
167
|
+
TypedData_Get_Struct(self, git_reference, &rugged_reference_type, ref);
|
|
159
168
|
|
|
160
169
|
if (git_reference_type(ref) == GIT_REF_OID) {
|
|
161
170
|
return rugged_create_oid(git_reference_target(ref));
|
|
@@ -173,7 +182,7 @@ static VALUE rb_git_ref_target_id(VALUE self)
|
|
|
173
182
|
static VALUE rb_git_ref_type(VALUE self)
|
|
174
183
|
{
|
|
175
184
|
git_reference *ref;
|
|
176
|
-
|
|
185
|
+
TypedData_Get_Struct(self, git_reference, &rugged_reference_type, ref);
|
|
177
186
|
|
|
178
187
|
switch (git_reference_type(ref)) {
|
|
179
188
|
case GIT_REF_OID:
|
|
@@ -201,7 +210,7 @@ static VALUE rb_git_ref_type(VALUE self)
|
|
|
201
210
|
static VALUE rb_git_ref_name(VALUE self)
|
|
202
211
|
{
|
|
203
212
|
git_reference *ref;
|
|
204
|
-
|
|
213
|
+
TypedData_Get_Struct(self, git_reference, &rugged_reference_type, ref);
|
|
205
214
|
return rb_str_new_utf8(git_reference_name(ref));
|
|
206
215
|
}
|
|
207
216
|
|
|
@@ -224,7 +233,7 @@ static VALUE rb_git_ref_resolve(VALUE self)
|
|
|
224
233
|
git_reference *resolved;
|
|
225
234
|
int error;
|
|
226
235
|
|
|
227
|
-
|
|
236
|
+
TypedData_Get_Struct(self, git_reference, &rugged_reference_type, ref);
|
|
228
237
|
|
|
229
238
|
error = git_reference_resolve(&resolved, ref);
|
|
230
239
|
rugged_exception_check(error);
|
|
@@ -290,7 +299,7 @@ static VALUE rb_git_reflog(VALUE self)
|
|
|
290
299
|
VALUE rb_log;
|
|
291
300
|
size_t i, ref_count;
|
|
292
301
|
|
|
293
|
-
|
|
302
|
+
TypedData_Get_Struct(self, git_reference, &rugged_reference_type, ref);
|
|
294
303
|
|
|
295
304
|
error = git_reflog_read(&reflog, git_reference_owner(ref), git_reference_name(ref));
|
|
296
305
|
rugged_exception_check(error);
|
|
@@ -320,7 +329,7 @@ static VALUE rb_git_has_reflog(VALUE self)
|
|
|
320
329
|
git_reference *ref;
|
|
321
330
|
git_repository *repo;
|
|
322
331
|
|
|
323
|
-
|
|
332
|
+
TypedData_Get_Struct(self, git_reference, &rugged_reference_type, ref);
|
|
324
333
|
repo = git_reference_owner(ref);
|
|
325
334
|
|
|
326
335
|
return git_reference_has_log(repo, git_reference_name(ref)) ? Qtrue : Qfalse;
|
|
@@ -335,7 +344,7 @@ static VALUE rb_git_has_reflog(VALUE self)
|
|
|
335
344
|
static VALUE rb_git_ref_is_branch(VALUE self)
|
|
336
345
|
{
|
|
337
346
|
git_reference *ref;
|
|
338
|
-
|
|
347
|
+
TypedData_Get_Struct(self, git_reference, &rugged_reference_type, ref);
|
|
339
348
|
return git_reference_is_branch(ref) ? Qtrue : Qfalse;
|
|
340
349
|
}
|
|
341
350
|
|
|
@@ -348,7 +357,7 @@ static VALUE rb_git_ref_is_branch(VALUE self)
|
|
|
348
357
|
static VALUE rb_git_ref_is_remote(VALUE self)
|
|
349
358
|
{
|
|
350
359
|
git_reference *ref;
|
|
351
|
-
|
|
360
|
+
TypedData_Get_Struct(self, git_reference, &rugged_reference_type, ref);
|
|
352
361
|
return git_reference_is_remote(ref) ? Qtrue : Qfalse;
|
|
353
362
|
}
|
|
354
363
|
|
|
@@ -361,7 +370,7 @@ static VALUE rb_git_ref_is_remote(VALUE self)
|
|
|
361
370
|
static VALUE rb_git_ref_is_tag(VALUE self)
|
|
362
371
|
{
|
|
363
372
|
git_reference *ref;
|
|
364
|
-
|
|
373
|
+
TypedData_Get_Struct(self, git_reference, &rugged_reference_type, ref);
|
|
365
374
|
return git_reference_is_tag(ref) ? Qtrue : Qfalse;
|
|
366
375
|
}
|
|
367
376
|
|