@@ -58,26 +58,15 @@ static VALUE rb_git_reference_collection_initialize(VALUE self, VALUE repo)
58
58
* Overwrites the reference with the given +name+, if it already exists,
59
59
* instead of raising an exception.
60
60
*
61
- * :message ::
62
- * A single line log message to be appended to the reflog.
63
- *
64
- * :signature ::
65
- * The signature to be used for populating the reflog entry.
66
- *
67
61
* If a reference with the given +name+ already exists and +:force+ is not +true+,
68
62
* an exception will be raised.
69
- *
70
- * The +:message+ and +:signature+ options are ignored if the reference does not
71
- * belong to the standard set (+HEAD+, +refs/heads/*+, +refs/remotes/*+ or +refs/notes/*+)
72
- * and it does not have a reflog.
73
63
*/
74
64
static VALUE rb_git_reference_collection_create (int argc , VALUE * argv , VALUE self )
75
65
{
76
66
VALUE rb_repo = rugged_owner (self ), rb_name , rb_target , rb_options ;
77
67
git_repository * repo ;
78
68
git_reference * ref ;
79
69
git_oid oid ;
80
- git_signature * signature = NULL ;
81
70
char * log_message = NULL ;
82
71
int error , force = 0 ;
83
72
@@ -89,28 +78,21 @@ static VALUE rb_git_reference_collection_create(int argc, VALUE *argv, VALUE sel
89
78
Check_Type (rb_target , T_STRING );
90
79
91
80
if (!NIL_P (rb_options )) {
92
- VALUE rb_val ;
93
-
94
- force = RTEST (rb_hash_aref (rb_options , CSTR2SYM ("force" )));
95
-
96
- rb_val = rb_hash_aref (rb_options , CSTR2SYM ("signature" ));
97
- if (!NIL_P (rb_val ))
98
- signature = rugged_signature_get (rb_val , repo );
99
-
100
- rb_val = rb_hash_aref (rb_options , CSTR2SYM ("message" ));
81
+ VALUE rb_val = rb_hash_aref (rb_options , CSTR2SYM ("message" ));
101
82
if (!NIL_P (rb_val ))
102
83
log_message = StringValueCStr (rb_val );
84
+
85
+ force = RTEST (rb_hash_aref (rb_options , CSTR2SYM ("force" )));
103
86
}
104
87
105
88
if (git_oid_fromstr (& oid , StringValueCStr (rb_target )) == GIT_OK ) {
106
89
error = git_reference_create (
107
- & ref , repo , StringValueCStr (rb_name ), & oid , force , signature , log_message );
90
+ & ref , repo , StringValueCStr (rb_name ), & oid , force , log_message );
108
91
} else {
109
92
error = git_reference_symbolic_create (
110
- & ref , repo , StringValueCStr (rb_name ), StringValueCStr (rb_target ), force , signature , log_message );
93
+ & ref , repo , StringValueCStr (rb_name ), StringValueCStr (rb_target ), force , log_message );
111
94
}
112
95
113
- git_signature_free (signature );
114
96
rugged_exception_check (error );
115
97
116
98
return rugged_ref_new (rb_cRuggedReference , rb_repo , ref );
@@ -284,26 +266,15 @@ static VALUE rb_git_reference_collection_exist_p(VALUE self, VALUE rb_name_or_re
284
266
* Overwrites the reference with the given +name+, if it already exists,
285
267
* instead of raising an exception.
286
268
*
287
- * :message ::
288
- * A single line log message to be appended to the reflog.
289
- *
290
- * :signature ::
291
- * The signature to be used for populating the reflog entry.
292
- *
293
269
* If a reference with the given +new_name+ already exists and +:force+ is not +true+,
294
270
* an exception will be raised.
295
- *
296
- * The +:message+ and +:signature+ options are ignored if the reference does not
297
- * belong to the standard set (+HEAD+, +refs/heads/*+, +refs/remotes/*+ or +refs/notes/*+)
298
- * and it does not have a reflog.
299
271
*/
300
272
static VALUE rb_git_reference_collection_rename (int argc , VALUE * argv , VALUE self )
301
273
{
302
274
VALUE rb_new_name , rb_name_or_ref , rb_options ;
303
275
VALUE rb_repo = rugged_owner (self );
304
276
git_reference * ref , * out = NULL ;
305
277
git_repository * repo ;
306
- git_signature * signature = NULL ;
307
278
char * log_message = NULL ;
308
279
int error , force = 0 ;
309
280
@@ -320,24 +291,17 @@ static VALUE rb_git_reference_collection_rename(int argc, VALUE *argv, VALUE sel
320
291
Data_Get_Struct (rb_repo , git_repository , repo );
321
292
322
293
if (!NIL_P (rb_options )) {
323
- VALUE rb_val ;
324
-
325
- force = RTEST (rb_hash_aref (rb_options , CSTR2SYM ("force" )));
326
-
327
- rb_val = rb_hash_aref (rb_options , CSTR2SYM ("signature" ));
328
- if (!NIL_P (rb_val ))
329
- signature = rugged_signature_get (rb_val , repo );
330
-
331
- rb_val = rb_hash_aref (rb_options , CSTR2SYM ("message" ));
294
+ VALUE rb_val = rb_hash_aref (rb_options , CSTR2SYM ("message" ));
332
295
if (!NIL_P (rb_val ))
333
296
log_message = StringValueCStr (rb_val );
297
+
298
+ force = RTEST (rb_hash_aref (rb_options , CSTR2SYM ("force" )));
334
299
}
335
300
336
301
if ((error = git_reference_lookup (& ref , repo , StringValueCStr (rb_name_or_ref ))) == GIT_OK )
337
- error = git_reference_rename (& out , ref , StringValueCStr (rb_new_name ), force , signature , log_message );
302
+ error = git_reference_rename (& out , ref , StringValueCStr (rb_new_name ), force , log_message );
338
303
339
304
git_reference_free (ref );
340
- git_signature_free (signature );
341
305
342
306
rugged_exception_check (error );
343
307
@@ -371,7 +335,6 @@ static VALUE rb_git_reference_collection_update(int argc, VALUE *argv, VALUE sel
371
335
{
372
336
VALUE rb_repo = rugged_owner (self ), rb_name_or_ref , rb_target , rb_options ;
373
337
git_repository * repo = NULL ;
374
- git_signature * signature = NULL ;
375
338
git_reference * ref = NULL , * out = NULL ;
376
339
char * log_message = NULL ;
377
340
int error ;
@@ -391,13 +354,7 @@ static VALUE rb_git_reference_collection_update(int argc, VALUE *argv, VALUE sel
391
354
rb_raise (rb_eTypeError , "Expecting a String or Rugged::Reference instance" );
392
355
393
356
if (!NIL_P (rb_options )) {
394
- VALUE rb_val ;
395
-
396
- rb_val = rb_hash_aref (rb_options , CSTR2SYM ("signature" ));
397
- if (!NIL_P (rb_val ))
398
- signature = rugged_signature_get (rb_val , repo );
399
-
400
- rb_val = rb_hash_aref (rb_options , CSTR2SYM ("message" ));
357
+ VALUE rb_val = rb_hash_aref (rb_options , CSTR2SYM ("message" ));
401
358
if (!NIL_P (rb_val ))
402
359
log_message = StringValueCStr (rb_val );
403
360
}
@@ -414,15 +371,14 @@ static VALUE rb_git_reference_collection_update(int argc, VALUE *argv, VALUE sel
414
371
error = git_oid_fromstr (& target , StringValueCStr (rb_target ));
415
372
if (error ) goto cleanup ;
416
373
417
- error = git_reference_set_target (& out , ref , & target , signature , log_message );
374
+ error = git_reference_set_target (& out , ref , & target , log_message );
418
375
} else {
419
- error = git_reference_symbolic_set_target (& out , ref , StringValueCStr (rb_target ), signature , log_message );
376
+ error = git_reference_symbolic_set_target (& out , ref , StringValueCStr (rb_target ), log_message );
420
377
}
421
378
422
379
cleanup :
423
380
424
381
git_reference_free (ref );
425
- git_signature_free (signature );
426
382
rugged_exception_check (error );
427
383
428
384
return rugged_ref_new (rb_cRuggedReference , rb_repo , out );
0 commit comments