rugged misinterpreting branch name as a SHA

Open
#916 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
git, ruby
Domain
tooling

Research direction

Start at lib/rugged/repository.rb:154 and run the supplied IRB reproducer with Repository#rev_parse. Trace how the name is classified during lookup, then verify that the branch name ITTO-4954-gdc resolves without the OID-prefix error.

Written by the indexing model from the issue text.

Description

Here is a reproducer, courtesy of @jarretlavallee

irb(main):001:0> require 'rugged'
=> true
irb(main):002:0> repo = Rugged::Repository.init_at('/tmp/test', :bare)
=> #<Rugged::Repository:22047760 {path: "/tmp/test/"}>
irb(main):003:0> repo.rev_parse('ITTO-4954-gdc')
Traceback (most recent call last):
        4: from /opt/puppetlabs/puppet/bin/irb:11:in `<main>'
        3: from (irb):3
        2: from /opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/rugged-0.27.7/lib/rugged/repository.rb:154:in `rev_parse'
        1: from /opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/rugged-0.27.7/lib/rugged/repository.rb:154:in `rev_parse'
Rugged::ObjectError (ambiguous lookup - OID prefix is too short)

somehow magic suffix -gdc makes rugged to err

Dominant language
C
Stars
2.3k
Forks
293
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from libgit2/rugged

All issues in libgit2/rugged

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.