Method: Rugged::Repository#default_signature

Defined in:
ext/rugged/rugged_repo.c

#default_signaturenil

Returns a Hash with the default user signature or nil.

Looks up the user.name and user.email from the configuration and uses the current time as the timestamp, and creates a new signature based on that information. It will return nil if either the user.name or user.email are not set.

Returns a Hash:

  • :name: the user.name config value

  • :email: the user.email config value

  • :time: the current time as a Time instance

Returns:

  • (nil)
[View source]

2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
# File 'ext/rugged/rugged_repo.c', line 2003

static VALUE rb_git_repo_default_signature(VALUE self) {
	int error;
	git_repository *repo;
	git_signature *signature;
	VALUE rb_signature;

	Data_Get_Struct(self, git_repository, repo);

	error = git_signature_default(&signature, repo);

	if (error == GIT_ENOTFOUND)
		return Qnil;

	rugged_exception_check(error);

	rb_signature = rugged_signature_new(signature, NULL);
	git_signature_free(signature);
	return rb_signature;
}