rugged 0.25.0b1 → 0.25.0b2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bbcf49a26d55dbaaf0d89824638a58cf8897df0e
4
- data.tar.gz: 5ce5dbfce098463431aad99034c49c58396d2216
3
+ metadata.gz: 4f92aa719b09c0bc6b851086d77eaceaee7d652c
4
+ data.tar.gz: e87ded2043f332eae518cdfd4405f7e05cf40413
5
5
  SHA512:
6
- metadata.gz: 059bab3bb87c0bd0070cffef4b33140a667cf31cbf612cab3f2b89131251d8c1e47de635e88fcda80e2b3f8d572c906e3bddc875e3937bf49a5f471db1866687
7
- data.tar.gz: 6e119cf6ccad1b2112885fe8b78f9bd93c46ffda7e9df8ec9bc6e2003710fc95400e25ef8bf9be1e8577dc5510ad4255e08390caf110c10a9b59d5843326e672
6
+ metadata.gz: 3bcc955d28541daed191f26bc4ae37a336bd0cb2a701da8a31990255920e1b87f2d0d20081bf41cda7ec4af1094acab9b08ca4c531e94dba74cc8f84a6cedb45
7
+ data.tar.gz: 79d06e428b8d9b03a3d132530e88e7b85e3c4865959ce553c5751a23c10cacca27308edb43b655a7982dbd296d107b6deba0dcfebb9ffe94cfa3a9b09e0d87c0
@@ -27,6 +27,8 @@
27
27
  extern VALUE rb_mRugged;
28
28
  extern VALUE rb_cRuggedIndex;
29
29
  extern VALUE rb_cRuggedRepo;
30
+ extern VALUE rb_cRuggedCommit;
31
+ extern VALUE rb_cRuggedReference;
30
32
 
31
33
  VALUE rb_cRuggedRebase;
32
34
 
@@ -67,6 +69,63 @@ VALUE rugged_rebase_new(VALUE klass, VALUE owner, git_rebase *rebase)
67
69
  return rb_rebase;
68
70
  }
69
71
 
72
+ struct get_annotated_commit_args {
73
+ git_annotated_commit **annotated_commit;
74
+ VALUE rb_repo;
75
+ VALUE rb_value;
76
+ };
77
+
78
+ static void get_annotated_commit(git_annotated_commit **annotated_commit, VALUE rb_repo, VALUE rb_value)
79
+ {
80
+ git_repository *repo;
81
+ int error;
82
+
83
+ rugged_check_repo(rb_repo);
84
+ Data_Get_Struct(rb_repo, git_repository, repo);
85
+
86
+ if (rb_obj_is_kind_of(rb_value, rb_cRuggedCommit)) {
87
+ const git_commit * commit;
88
+ const git_oid * oid;
89
+
90
+ Data_Get_Struct(rb_value, git_commit, commit);
91
+
92
+ oid = git_commit_id(commit);
93
+ error = git_annotated_commit_lookup(annotated_commit, repo, oid);
94
+ } else if (rb_obj_is_kind_of(rb_value, rb_cRuggedReference)) {
95
+ const git_reference * ref;
96
+
97
+ Data_Get_Struct(rb_value, git_reference, ref);
98
+
99
+ error = git_annotated_commit_from_ref(annotated_commit, repo, ref);
100
+ } else if (TYPE(rb_value) == T_STRING) {
101
+ error = git_annotated_commit_from_revspec(annotated_commit, repo, StringValueCStr(rb_value));
102
+ } else {
103
+ rb_raise(rb_eTypeError, "Expecting a Rugged::Reference, Rugged::Commit or String instance");
104
+ }
105
+
106
+ rugged_exception_check(error);
107
+ }
108
+
109
+ static void get_annotated_commit_wrapper(struct get_annotated_commit_args *args)
110
+ {
111
+ get_annotated_commit(args->annotated_commit, args->rb_repo, args->rb_value);
112
+ }
113
+
114
+ static int rugged_get_annotated_commit(
115
+ git_annotated_commit ** annotated_commit, VALUE rb_repo, VALUE rb_value)
116
+ {
117
+ struct get_annotated_commit_args args;
118
+ int exception;
119
+
120
+ args.annotated_commit = annotated_commit;
121
+ args.rb_repo = rb_repo;
122
+ args.rb_value = rb_value;
123
+
124
+ rb_protect((VALUE (*)(VALUE))get_annotated_commit_wrapper, (VALUE)&args, &exception);
125
+
126
+ return exception;
127
+ }
128
+
70
129
  /*
71
130
  * call-seq:
72
131
  * Rebase.new(repo, branch, upstream[, onto][, options]) -> Rebase
@@ -100,9 +159,8 @@ VALUE rugged_rebase_new(VALUE klass, VALUE owner, git_rebase *rebase)
100
159
  */
101
160
  static VALUE rb_git_rebase_new(int argc, VALUE* argv, VALUE klass)
102
161
  {
103
- int error;
104
- const char* str_branch = NULL, *str_upstream = NULL, *str_onto = NULL;
105
- git_rebase *rebase;
162
+ int error = 0, exception = 0;
163
+ git_rebase *rebase = NULL;
106
164
  git_repository *repo;
107
165
  git_annotated_commit *branch = NULL, *upstream = NULL, *onto = NULL;
108
166
  VALUE rb_repo, rb_branch, rb_upstream, rb_onto, rb_options;
@@ -110,24 +168,20 @@ static VALUE rb_git_rebase_new(int argc, VALUE* argv, VALUE klass)
110
168
 
111
169
  rb_scan_args(argc, argv, "31:", &rb_repo, &rb_branch, &rb_upstream, &rb_onto, &rb_options);
112
170
  Data_Get_Struct(rb_repo, git_repository, repo);
113
- str_branch = rugged_refname_from_string_or_ref(rb_branch);
114
- str_upstream = rugged_refname_from_string_or_ref(rb_upstream);
115
- Check_Type(rb_branch, T_STRING);
116
- Check_Type(rb_upstream, T_STRING);
117
- if (!NIL_P(rb_onto))
118
- str_onto = rugged_refname_from_string_or_ref(rb_onto);
119
171
 
120
- parse_rebase_options(&options, rb_options);
172
+ if ((exception = rugged_get_annotated_commit(&branch, rb_repo, rb_branch)))
173
+ goto cleanup;
121
174
 
122
- if ((error = git_annotated_commit_from_revspec(&branch, repo, str_branch)) < 0 ||
123
- (error = git_annotated_commit_from_revspec(&upstream, repo, str_upstream)) < 0)
175
+ if ((exception = rugged_get_annotated_commit(&upstream, rb_repo, rb_upstream)))
124
176
  goto cleanup;
125
177
 
126
178
  if (!NIL_P(rb_onto)) {
127
- if ((error = git_annotated_commit_from_revspec(&onto, repo, str_onto)) < 0)
179
+ if ((exception = rugged_get_annotated_commit(&onto, rb_repo, rb_onto)))
128
180
  goto cleanup;
129
181
  }
130
182
 
183
+ parse_rebase_options(&options, rb_options);
184
+
131
185
  error = git_rebase_init(&rebase, repo, branch, upstream, onto, &options);
132
186
 
133
187
  cleanup:
@@ -135,7 +189,11 @@ cleanup:
135
189
  git_annotated_commit_free(upstream);
136
190
  git_annotated_commit_free(onto);
137
191
 
138
- rugged_exception_check(error);
192
+ if (error) {
193
+ rugged_exception_check(error);
194
+ } else if (exception) {
195
+ rb_jump_tag(exception);
196
+ }
139
197
 
140
198
  return rugged_rebase_new(klass, rb_repo, rebase);
141
199
  }
@@ -237,6 +295,8 @@ static VALUE rb_git_rebase_commit(int argc, VALUE *argv, VALUE self)
237
295
  Data_Get_Struct(self, git_rebase, rebase);
238
296
  rb_scan_args(argc, argv, ":", &rb_options);
239
297
 
298
+ Check_Type(rb_options, T_HASH);
299
+
240
300
  rb_author = rb_hash_aref(rb_options, CSTR2SYM("author"));
241
301
  rb_committer = rb_hash_aref(rb_options, CSTR2SYM("committer"));
242
302
  rb_message = rb_hash_aref(rb_options, CSTR2SYM("message"));
@@ -345,11 +405,3 @@ void Init_rugged_rebase(void)
345
405
  rb_define_method(rb_cRuggedRebase, "abort", rb_git_rebase_abort, 0);
346
406
  rb_define_method(rb_cRuggedRebase, "finish", rb_git_rebase_finish, 1);
347
407
  }
348
-
349
-
350
-
351
-
352
-
353
-
354
-
355
-
@@ -1,3 +1,3 @@
1
1
  module Rugged
2
- Version = VERSION = '0.25.0b1'
2
+ Version = VERSION = '0.25.0b2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rugged
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.0b1
4
+ version: 0.25.0b2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chacon
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-03-10 00:00:00.000000000 Z
12
+ date: 2016-04-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler
@@ -532,7 +532,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
532
532
  version: 1.3.1
533
533
  requirements: []
534
534
  rubyforge_project:
535
- rubygems_version: 2.2.5
535
+ rubygems_version: 2.4.5
536
536
  signing_key:
537
537
  specification_version: 4
538
538
  summary: Rugged is a Ruby binding to the libgit2 linkable library