Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle orphaned commits #74

Merged
merged 1 commit into from
May 16, 2022
Merged

Handle orphaned commits #74

merged 1 commit into from
May 16, 2022

Conversation

chelnak
Copy link
Owner

@chelnak chelnak commented May 16, 2022

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

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 commit 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.
@chelnak chelnak merged commit a3c5919 into main May 16, 2022
@chelnak chelnak deleted the handle_orphaned_commits branch May 16, 2022 20:33
@chelnak chelnak added the bug Something isn't working label May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gitclient.GetFirstCommit() can return two SHAs
1 participant