You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 2, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 2, 2026. It is now read-only.
I am trying to follow these instructions to perform a cherry-pick in a bare repository. This is what I ended up with:
asynccherryPickWithMessage(localBranch: string,commit: string,message: string){consttheirCommit=awaitthis.repo.getCommit(commit);constourCommit=awaitthis.repo.getBranchCommit(localBranch);constbase=awaitGit.Merge.base(this.repo,theirCommit.id(),ourCommit.id());// nodegit has a bug that causes .parent() to return a "partial" commit that// cannot be used for subsequent operations such as .getTree(). See// https://github.com/nodegit/nodegit/pull/1110.constbaseTreeId=awaittheirCommit.parent(0).then(c=>c.treeId());constbaseTree=awaitthis.repo.getTree(baseTreeId);consttheirTree=awaittheirCommit.getTree();constourTree=awaitourCommit.getTree();// This does not work.constindex=awaitGit.Merge.trees(this.repo,baseTree,ourTree,theirTree,null);constnewTreeId=awaitindex.writeTree();constownCommitterSignature=theirCommit.committer();// TODOreturnawaitthis.repo.createCommit(localBranch,theirCommit.author(),ownCommitterSignature,message,newTreeId,[ourCommit]).then(id=>id.tostrS());}
The critical point is calling Git.Merge.trees. The documentation says that the fifth parameter is optional:
the merge tree options (or null for defaults)
However, when passing the options as described above, this error is thrown (which might be a bug):
Error: MergeOptions opts is required.
at F:\node-cq\node_modules\nodegit-promise\lib\node-extensions.js:24:20
at tryCallTwo (F:\node-cq\node_modules\nodegit-promise\lib\core.js:45:5)
at doResolve (F:\node-cq\node_modules\nodegit-promise\lib\core.js:173:13)
at new Promise (F:\node-cq\node_modules\nodegit-promise\lib\core.js:65:3)
at Function.trees (F:\node-cq\node_modules\nodegit-promise\lib\node-extensions.js:19:12)
at LG2Repository.<anonymous> (F:\node-cq\lib\local-git\libgit2.ts:42:35)
at Generator.next (<anonymous>)
at fulfilled (F:\node-cq\lib\local-git\libgit2.ts:4:58)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7)
I tried passing an empty object {} as the opts parameter, which causes a CRT assertion (which - I assume - is definitely a bug):
Is there a proper way to use this API without triggering an assertion or error?
Activity
Fix argument handling in Git.Merge.trees