Method: Rugged::Blob.from_workdir

Defined in:
ext/rugged/rugged_blob.c

.from_workdir(repository, file_path) ⇒ Object

Write the file specified in file_path to a blob in repository. file_path must be relative to the repository’s working folder. The repository cannot be bare.

Blob.from_workdir(repo, 'src/blob.h') #=> '9d09060c850defbc7711d08b57def0d14e742f4e'

164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'ext/rugged/rugged_blob.c', line 164

static VALUE rb_git_blob_from_workdir(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_fromworkdir(&oid, repo, StringValueCStr(rb_path));
	rugged_exception_check(error);

	return rugged_create_oid(&oid);
}