Skip to content

Add Repository.revert()#1297

Merged
jdavid merged 1 commit into
libgit2:masterfrom
jorio:revert
May 29, 2024
Merged

Add Repository.revert()#1297
jdavid merged 1 commit into
libgit2:masterfrom
jorio:revert

Conversation

@jorio

@jorio jorio commented May 28, 2024

Copy link
Copy Markdown
Contributor

This exposes libgit2's git_revert(), which produces changes in the index and working directory. It also affects the repository's state (via .git/REVERT_HEAD) and prepared message (via .git/MERGE_MSG).

Rationale for adding this even though Repository.revert_commit() already exists: revert_commit() is a binding for git_revert_commit(), which is less powerful -- it doesn't check out the resulting index, and it doesn't modify the state and prepared message.


Note: git_revert() accepts additional checkout/revert settings. We could implement support for these as extra arguments to Repository.revert() in the future.

This exposes libgit2's git_revert(), which produces changes in the index and working directory. It also affects the repository's state (via .git/REVERT_HEAD) and prepared message (via .git/MERGE_MSG).

The existing function Repository.revert_commit(), which exposes git_revert_commit(), is less powerful -- it doesn't check out the resulting index, and it doesn't modify the state and prepared message.

Note: git_revert() takes additional checkout/revert settings. We could implement support for these as extra arguments to Repository.revert() in the future.
@jdavid jdavid merged commit 584bda3 into libgit2:master May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants