diff --git a/src/commit.ts b/src/commit.ts index 0c79a747..ff6f5a6e 100644 --- a/src/commit.ts +++ b/src/commit.ts @@ -57,8 +57,7 @@ export class Commit { this.parent ? [...this.parent] : []); commit.hash = this.hash; - commit.tags = []; - if (this.tags != null) { + if (this.tags.length > 0) { commit.tags = [...this.tags]; } @@ -85,10 +84,6 @@ export class Commit { return; } - if (this.tags == null) { - this.tags = []; - } - if (this.tags.includes(tag)) { return; } diff --git a/src/odb.ts b/src/odb.ts index 40774031..24f819d3 100644 --- a/src/odb.ts +++ b/src/odb.ts @@ -135,6 +135,14 @@ export class Odb { return commits.map((commit: any) => { const tmpCommit = commit; + if (!tmpCommit.tags) { + tmpCommit.tags = []; + } + + if (!tmpCommit.userData) { + tmpCommit.userData = {}; + } + tmpCommit.date = new Date(tmpCommit.date); // convert number from JSON into date object const c: Commit = Object.setPrototypeOf(tmpCommit, Commit.prototype); c.repo = this.repo; diff --git a/src/reference.ts b/src/reference.ts index 92f96a39..4cf87979 100644 --- a/src/reference.ts +++ b/src/reference.ts @@ -63,7 +63,7 @@ export class Reference { }); ref.userData = {}; - if (this.userData != null) { + if (this.userData !== null) { ref.userData = { ...this.userData }; }