Repository#head throws exception, but documentation seems to imply it should return nil?
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
Research direction
Start with lib/relaxo/database.rb:48 and the failing example in spec/relaxo/database_spec.rb, then compare Rugged::Repository#head with the linked API documentation for a newly created repository. Done means the empty-repository behavior is defined and the clear! expectation no longer raises unexpectedly.
Written by the indexing model from the issue text.
Description
I have to do the following
# Completely clear out the database.
def clear!
if head = @repository.head
@repository.references.delete(head)
end
rescue Rugged::ReferenceError
return nil
end
@repository.head on a newly created repo throws:
1) Relaxo::Database can clear database
Failure/Error:
expect do
database.clear!
end.to_not raise_error
expected no Exception, got #<Rugged::ReferenceError: reference 'refs/heads/master' not found> with backtrace:
# ./lib/relaxo/database.rb:48:in `head'
# ./lib/relaxo/database.rb:48:in `clear!'
# ./spec/relaxo/database_spec.rb:20:in `block (3 levels) in <top (required)>'
The documentation seems to imply this should return nil?
https://www.rubydoc.info/github/libgit2/rugged/Rugged%2FRepository:head
Thanks!
- 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
- 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.
More from libgit2/rugged
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
Similar issues
-
level/task module/gcp type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
hapostgres/pg_auto_failover#1190 ·
-
docs
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
P3 sonic-vpp
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sonic-net/sonic-buildimage#29662 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 94/100
spack/spack-packages#6586 ·