Rugged::Repository.merge_base complains when the merge base is a graft
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- developer-experience, tooling
Research direction
Start with the linked libgit2_merge_base reproduction and the Rugged::Repository.merge_base entry point; reproduce the failure using the shallow fetch and graft merge base described here. Compare its result with git merge-base and verify that the object-not-found error no longer occurs without increasing the shallow depth.
Written by the indexing model from the issue text.
Description
Hello, I have some CI jobs that try to avoid checking out unnecessary commits for merges. They call the GitHub API to see how many commits behind/ahead they are, compared to the base branch, and then fetch the base/merge branch with depth equal to number of commits they are behind/ahead + 1.
When one of the test tools calls Rugged::Repository.merge_base, if the merge base commit is a graft commit (from the shallow fetch), I get an error like:
Traceback (most recent call last):
1: from show_merge_base.rb:9:in `<main>'
show_merge_base.rb:9:in `merge_base': object not found - no match for id (fab6d6845fe971f1bb15b793c5604ce7aeb0eaa2) (Rugged::OdbError)
where fab6d6845fe971f1bb15b793c5604ce7aeb0eaa2 is the parent of the grafted commit.
I see that git handles it fine :
$ git merge-base HEAD master
6e85c6c9868ba19e1b8c2f41890f02d37d9c8634
Increasing the shallow depth by one prevents the error, but I feel like merge_base shouldn't be looking for commits that aren't needed to calculate the merge base.
I created a repo to make it easier to reproduce the error, and included exact steps: https://github.com/dgholz/libgit2_merge_base
- 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
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
BasedHardware/omi#15662 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
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