Method: Rugged::Repository#descendant_of?

Defined in:
ext/rugged/rugged_repo.c

#descendant_of?(commit, ancestor) ⇒ Boolean

commit and ancestor must be String commit OIDs or instances of Rugged::Commit.

Returns true if commit is a descendant of ancestor, or false if not.

Returns:

  • (Boolean)


1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
# File 'ext/rugged/rugged_repo.c', line 1299

static VALUE rb_git_repo_descendant_of(VALUE self, VALUE rb_commit, VALUE rb_ancestor)
{
  int result;
  int error;
  git_repository *repo;
  git_oid commit, ancestor;

  Data_Get_Struct(self, git_repository, repo);

  error = rugged_oid_get(&commit, repo, rb_commit);
  rugged_exception_check(error);

  error = rugged_oid_get(&ancestor, repo, rb_ancestor);
  rugged_exception_check(error);

  result = git_graph_descendant_of(repo, &commit, &ancestor);
  rugged_exception_check(result);

  return result ? Qtrue : Qfalse;
}