Method: Rugged::Rebase#next

Defined in:
ext/rugged/rugged_rebase.c

#nextnil

Perform the next step in the rebase. The returned operation is a Hash with its details or nil if there are no more operations to perform. The Hash contains some of the following entries:

:type

The type of operation being done. Can be one of :pick, :reword, :edit, :squash, :fixup or :exec.

:id

The id of the commit being cherry-picked. Exists for all but :exec operations.

:exec

If the operatin is :exec this is what the user asked to be executed.

Returns:

  • (nil)

205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'ext/rugged/rugged_rebase.c', line 205

static VALUE rb_git_rebase_next(VALUE self)
{
	int error;
	git_rebase *rebase;
	git_rebase_operation *operation;
	VALUE hash, val;

	Data_Get_Struct(self, git_rebase, rebase);
	error = git_rebase_next(&operation, rebase);
	if (error == GIT_ITEROVER)
		return Qnil;

	rugged_exception_check(error);

	/* Create the operation hash out of the relevant details */
	hash = rb_hash_new();

	val = rebase_operation_type(operation);
	rb_hash_aset(hash, CSTR2SYM("type"), val);

	if (operation->type != GIT_REBASE_OPERATION_EXEC) {
		val = rugged_create_oid(&operation->id);
		rb_hash_aset(hash, CSTR2SYM("id"), val);
	}

	if (operation->exec) {
		val = rb_str_new_utf8(operation->exec);
		rb_hash_aset(hash, CSTR2SYM("exec"), val);
	}

	return hash;
}