-
Notifications
You must be signed in to change notification settings - Fork 72
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
Block the creation of empty commits #470
Conversation
In specific cases, the update mechanism may lead to no files being changed. The changes short-circuit the process to exit early when 0 files have been modified. go-git has been changed to return an error when an empty commit is detected, which is used as a last resort. When the push branch is different than the clone branch, the controller will now download all branch references from the Git server, in order to enable a single fetch operation. Signed-off-by: Paulo Gomes <[email protected]>
} else { | ||
err = extgogit.ErrEmptyCommit | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we creating an error here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to be able to reuse the existing logic for handling empty commits.
Given that this controller will be refactored as part of the GA process, I found this was the easiest way to resolve the problem without duplicating code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @pjbgf 💯
In specific cases, the update mechanism may lead to no files being changed. The changes short-circuit the process to exit early when 0 files have been modified.
go-git has been changed to return an error when an empty commit is detected, which is used as a last resort.
When the push branch is different than the clone branch, the controller will now download all branch references from the Git server, in order to enable a single fetch operation.
Fixes #466.