Skip to content

Commit

Permalink
log: fix crash on new files
Browse files Browse the repository at this point in the history
  • Loading branch information
wmertens committed Feb 11, 2021
1 parent 8ce7011 commit 3fb3179
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions source/nodegit.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,13 @@ class NGWrap {
const files = {};
for (const f of await r.getStatusExt()) {
const fileName = f.path();
const diff = f.indexToWorkdir();
const oldFileName = diff.oldFile().path();
let oldFileName;
if (!f.isNew()) {
const diff = f.indexToWorkdir();
oldFileName = diff.oldFile().path();
} else {
oldFileName = fileName;
}
const displayName = f.isRenamed() ? `${oldFileName}${fileName}` : fileName;
files[fileName] = {
fileName,
Expand Down

0 comments on commit 3fb3179

Please sign in to comment.