Method: Rugged::Blob.from_buffer

Defined in:
ext/rugged/rugged_blob.c

.from_buffer(repository, buffer) ⇒ Object

Write a blob to repository with the contents specified in buffer, where buffer is a String. The encoding of buffer is ignored and bytes are copied as-is.

[View source]

137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'ext/rugged/rugged_blob.c', line 137

static VALUE rb_git_blob_from_buffer(VALUE self, VALUE rb_repo, VALUE rb_buffer)
{
	int error;
	git_oid oid;
	git_repository *repo;

	Check_Type(rb_buffer, T_STRING);
	rugged_check_repo(rb_repo);

	Data_Get_Struct(rb_repo, git_repository, repo);

	error = git_blob_create_frombuffer(&oid, repo, RSTRING_PTR(rb_buffer), RSTRING_LEN(rb_buffer));
	rugged_exception_check(error);

	return rugged_create_oid(&oid);
}