rugged icon indicating copy to clipboard operation
rugged copied to clipboard

Rugged::Walker gives wrong argument type Rugged::Commit (expected Data)

Open djberg96 opened this issue 5 years ago • 1 comments

ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19] rugged 1.1.0

The Rugged::Walker#push method is supposed to accept an oid string or a Rugged::Commit instance according to the docs: https://www.rubydoc.info/gems/rugged/Rugged/Walker#push-instance_method

However, we're seeing TypeError: wrong argument type Rugged::Commit (expected Data) when we try to pass a Rugged::Commit instance.

We can fix this by specifying the #oid, but I wanted to verify that this is expected behavior.

djberg96 avatar Oct 17 '20 13:10 djberg96

Related to https://github.com/prontolabs/pronto/pull/380

abinoam avatar Feb 16 '21 09:02 abinoam

@carlosmn I also ran into this issue:

require 'rugged'

repository = Rugged::Repository.discover(Dir.pwd)

Rugged::Walker.walk(repository, show: repository.head.target) do |walker|
  walker.each do |commit|
    puts commit.oid
  end
end

ioquatix avatar Sep 02 '22 05:09 ioquatix

Well the code does seem to want accept a git object. It looks like maybe the rb_obj_is_kind_of(rb_commit, rb_cRuggedObject) check is returning false which is why we'd hit the Check_Type(rb_commit, T_STRING); that seems to be triggering this.

carlosmn avatar Sep 06 '22 09:09 carlosmn

Nope, it looks like it was a leftover Data_Get_Struct when it should have been TypedData_Get_Struct.

carlosmn avatar Sep 06 '22 10:09 carlosmn

That might explain the segfaults I was getting :)

ioquatix avatar Sep 06 '22 23:09 ioquatix