diff options
author | Paulo Gomes <pjbgf@linux.com> | 2022-12-03 16:34:35 +0000 |
---|---|---|
committer | Paulo Gomes <pjbgf@linux.com> | 2022-12-03 16:34:35 +0000 |
commit | a513415283c4628259c016587858fe56d7b0fa13 (patch) | |
tree | c39b970b1403d10693795ad6d61dd1ea59db4a2d /plumbing/object | |
parent | 3e07c5030b4e3b2fcbcb461f9f6b23212f978335 (diff) | |
download | go-git-a513415283c4628259c016587858fe56d7b0fa13.tar.gz |
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>
Diffstat (limited to 'plumbing/object')
0 files changed, 0 insertions, 0 deletions