Method: Rugged::Blob.from_disk

Defined in:
ext/rugged/rugged_blob.c

.from_disk(repository, file_path) ⇒ Object

Write the file specified in file_path to a blob in repository. The repository can be bare or not.

Example:

Blob.from_disk(repo, '/var/repos/blob.h') #=> '5b5b025afb0b4c913b4c338a42934a3863bf3643'

192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'ext/rugged/rugged_blob.c', line 192

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

	FilePathValue(rb_path);
	rugged_check_repo(rb_repo);

	Data_Get_Struct(rb_repo, git_repository, repo);

	error = git_blob_create_fromdisk(&oid, repo, StringValueCStr(rb_path));
	rugged_exception_check(error);

	return rugged_create_oid(&oid);
}