chelnak / gh-changelog

A gh cli extension that will make your changelogs ✨
MIT License
110 stars 4 forks source link

Handle orphaned commits #74

Closed chelnak closed 2 years ago

chelnak commented 2 years ago

Sometimes repositories can contain more than one commit with no parents.

This meant that in some situations GetFirstCommit() could return more than one SHA, causing the application to break as downstream methods would not expect the input.

This PR handles this edge case by reversing the order of commits from rev-list, splitting by new line and always returning the sha at position 0.

In theory this should always be the oldest commit in the repository.

In the future logging should be added here.

Fixes #73