Rugged::Tree#path throws exception when path doesn't exist
Open
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 2.3k
- Forks
- 293
- PR merge metrics
- No merged PRs in 30d
Description
Rugged::Tree#path throws an exception if the path doesn't exist. But this can often be normal control flow.
> @tree.path("foo/bar")
Rugged::TreeError: the path 'foo' does not exist in the given tree
There are definitely exceptional cases - e.g. corruption of the git repository.
Solution:
- Mark this method as deprecated.
- Introduce new method
fetch(path, default=nil, &block)which works similar toHash#fetch.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Rugged::Tree#path entry point and trace how a missing path is currently handled. Define the proposed fetch(path, default=nil, &block) behavior against the issue's Hash#fetch comparison, while preserving exceptional repository errors; done means path is deprecated and fetch covers the requested missing-path cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, ruby
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100