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

CommitOptions: AllowEmptyCommits, return error instead of creating empty commits #623

Merged
merged 1 commit into from Dec 11, 2022

Commits on Dec 3, 2022

  1. Return error instead of creating empty commits

    BuildTree now returns an ErrEmptyCommit error, when there are no
    changes to be committed. This can be opted-out via
    CommitOptions.AllowEmptyCommits.
    
    This is a breaking change which enables applications to detect when
    empty commits are to be created.
    
    Some instances in which this can occur is when the fs (e.g. `billy/osfs`)
    make changes to the underlying files, causing a conflict between what
    the previous Git worktree state was, and the current state. Changes to
    the fs implementations are orthogonal to this, and will be dealt with
    separately.
    
    The new behaviour aligns with the Git CLI, in which empty commits
    returns the error message: 'nothing to commit, working tree clean'.
    
    Signed-off-by: Paulo Gomes <pjbgf@linux.com>
    pjbgf committed Dec 3, 2022
    Copy the full SHA
    a513415 View commit details
    Browse the repository at this point in the history