Method: Rugged::Repository#ident=

Defined in:
ext/rugged/rugged_repo.c

#ident=(ident) ⇒ Object

Set the identity to be used for writing reflogs.

ident can be either nil or a Hash containing name and/or email entries.

[View source]

709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
# File 'ext/rugged/rugged_repo.c', line 709

static VALUE rb_git_repo_set_ident(VALUE self, VALUE rb_ident) {
	VALUE rb_val;

	git_repository *repo;
	const char *name = NULL, *email = NULL;

	Data_Get_Struct(self, git_repository, repo);

	if (!NIL_P(rb_ident)) {
		Check_Type(rb_ident, T_HASH);

		if (!NIL_P(rb_val = rb_hash_aref(rb_ident, CSTR2SYM("name")))) {
			Check_Type(rb_val, T_STRING);
			name = StringValueCStr(rb_val);
		}

		if (!NIL_P(rb_val = rb_hash_aref(rb_ident, CSTR2SYM("email")))) {
			Check_Type(rb_val, T_STRING);
			email = StringValueCStr(rb_val);
		}
	}

	rugged_exception_check(
		git_repository_set_ident(repo, name, email)
	);

	return Qnil;
}