Merge.bases only returns one Oid
Open
Nobody has claimed this yet.
Bug
- Dominant language
- JavaScript
- Stars
- 5.8k
- Forks
- 704
- PR merge metrics
- No merged PRs in 30d
Description
How do you get multiple Oid out of an an Oid array? The Oids don't seems to be indexes, a call to oidarray.ids() returns one Oid, and multiple calls return the same Oid.
Setup:
git init
git commit --allow-empty --message foo1
git checkout -b dev
git commit --allow-empty --message foo2
git checkout master
git commit --allow-empty --message foo3
git merge -m "first merge base" dev
git checkout dev
git merge -m "second merge base" master~1
git merge-base --all master dev
# cac0d9e9c4d20fa2d09dcc9dfdbe44fcb5ad60d3
# 986123894e73887c35a1ee8294e9a17f1536144d
Script:
'use strict';
const git = require('nodegit');
function branchesOid(repo) {
return Promise.all([
repo.getReferenceCommit('master'),
repo.getReferenceCommit('dev'),
]).then(commits => commits.map(c => c.id()));
}
git.Repository.open('.git').then(repo => {
return branchesOid(repo).then(oid => git.Merge.bases(repo, ...oid))
}).then(oidarray => console.log(
oidarray.count(),
oidarray[0],
oidarray[1],
oidarray.ids(),
oidarray.ids()
));
Result:
$ node merge-base.js
2 undefined undefined [Oid cac0d9e9c4d20fa2d09dcc9dfdbe44fcb5ad60d3] [Oid cac0d9e9c4d20fa2d09dcc9dfdbe44fcb5ad60d3]
Contributor guide
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 by running the merge-base.js reproduction and tracing the git.Merge.bases entry point in the NodeGit bindings. Done means the returned collection exposes both merge-base Oids consistently, including through the access patterns shown in the report.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, javascript, node.js
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100