Skip to content

diffSummary is incorrect for the first commit #1035

Closed
@web-dev-sam

Description

@web-dev-sam

When comparing the first commit with the empty tree to see what changes the first commit introduced it displays the "changes" correctly but additions/deletions are wrong.

const EMPTY_TREE = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
const fromRepo = simpleGit("...")
console.log(await fromRepo.diffSummary([EMPTY_TREE, await fromRepo.firstCommit()]))

Git Output: git diff 4b825dc642cb6eb9a060e54bf8d69288fbee4904 8a424bd942b041bc924989e8ab3c77a63e26826d

diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..5d329db
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,12 @@
+NUXT_AUTH_ORIGIN= # No trailing slash
+NUXT_SESSION_PASSWORD=
+
+NUXT_OAUTH_GOOGLE_CLIENT_ID=
+NUXT_OAUTH_GOOGLE_CLIENT_SECRET=
+NUXT_OAUTH_GITHUB_CLIENT_ID=
+NUXT_OAUTH_GITHUB_CLIENT_SECRET=
+NUXT_OAUTH_GITHUB_CONNECT_CLIENT_ID=
+NUXT_OAUTH_GITHUB_CONNECT_CLIENT_SECRET=
+
+NUXT_POSTGRES_URL=
+RESEND_API_KEY=

git-js Output:

{
      file: ".env.example",   // correct
      changes: 12,            // correct
      insertions: 4,          // incorrect
      deletions: 0,           // incorrect
      binary: false           // correct
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    more-info-neededMore information is required in order to investigate

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions