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
import Nodegit from "nodegit";
const repo = await Nodegit.Repository.open("/home/user/git/linux");
const c = await Nodegit.Commit.lookupPrefix(repo, Nodegit.Oid.fromString("4387bfa605206b57451e6f77af1287960981ffa2"), 40);
console.log(c.sha(), c.getDiff());
leads to an exception:
/home/user/git/analysis/node_modules/nodegit/dist/commit.js:290
return this.repo.getTree(this.treeId());
^
TypeError: Cannot read properties of undefined (reading 'getTree')
at Commit.getTree (/home/user/git/analysis/node_modules/nodegit/dist/commit.js:290:20)
at Commit.getDiffWithOptions (/home/user/git/analysis/node_modules/nodegit/dist/commit.js:209:17)
at Commit.getDiff (/home/user/git/analysis/node_modules/nodegit/dist/commit.js:195:15)
at file:///home/user/git/analysis/test.mjs:6:24
The issue is analog to #1658, and can be fixed the same way.
However it might be better to have a generic wrapper for commit objects being returned by the raw api.
Activity