Method: Rugged::Diff#each_patch
- Defined in:
- ext/rugged/rugged_diff.c
permalink #each_patch {|patch| ... } ⇒ self #each_patch ⇒ Object Also known as: each
If given a block, yields each patch that is part of the diff. If no block is given, an enumerator will be returned.
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 |
# File 'ext/rugged/rugged_diff.c', line 443
static VALUE rb_git_diff_each_patch(VALUE self)
{
git_diff *diff;
git_patch *patch;
int error = 0;
size_t d, delta_count;
RETURN_ENUMERATOR(self, 0, 0);
Data_Get_Struct(self, git_diff, diff);
delta_count = git_diff_num_deltas(diff);
for (d = 0; d < delta_count; ++d) {
error = git_patch_from_diff(&patch, diff, d);
if (error) break;
rb_yield(rugged_patch_new(self, patch));
}
rugged_exception_check(error);
return self;
}
|