Method: Rugged::Repository#head

Defined in:
ext/rugged/rugged_repo.c

#headObject

Retrieve and resolve the reference pointed at by the repository’s HEAD.

Returns nil if HEAD is missing.


1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
# File 'ext/rugged/rugged_repo.c', line 1517

static VALUE rb_git_repo_get_head(VALUE self)
{
	git_repository *repo;
	git_reference *head;
	int error;

	Data_Get_Struct(self, git_repository, repo);

	error = git_repository_head(&head, repo);
	if (error == GIT_ENOTFOUND)
		return Qnil;
	else
		rugged_exception_check(error);

	return rugged_ref_new(rb_cRuggedReference, self, head);
}