libgit2 / libgit2/rugged

Unexpected Rugged::ZlibError in Commit#header_field

Open
#564 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

rugged_exception_raise seems to raise the wrong exception after a specific series of method calls.

  1. Repository#lookup
  2. Repository#read_header
  3. Commit#header_field (with args that will cause an exception)

The final call should raise a RuntimeError afaict, but it actually raises a Rugged::ZlibError.

Here's some tests that demonstrate this behavior.
#563 actually fixes this specific case, because it catches the GIT_ENOTFOUND without calling rugged_exception_check, but it seems like there might be an underlying problem as well that should be fixed.

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.

Research direction

Start with the linked tests demonstrating the sequence of Repository#lookup, Repository#read_header, and Commit#header_field, then trace how rugged_exception_raise handles the resulting error. Compare the observed Rugged::ZlibError with the expected RuntimeError and verify that the underlying exception behavior is corrected without regressing the case addressed by #563.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, ruby
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.