-
Notifications
You must be signed in to change notification settings - Fork 600
Add support for "git revert" #4570
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
Comments
@Byron I think you've looked branch name normalization? There are sort of two problems here from a users perspective, first that a revert creates a new branch (but this is currently by design), but the invalid branch name is from what understand a new thing. The error message comes from libgit2: https://github.com/libgit2/libgit2/blob/503b66cf00ad7dca940148529f60b1a409ccc462/src/libgit2/refs.c#L1017 |
Indeed, this has been improved and it will now fail early, during normalization, as it detects invalid branch names before they are used (like is the case with the error message indicating I even was able to reproduce the issue, but could also recover from it with
When deleting it, there is an error message, but the deletion works. Trying to rename it fails as it can't do anything with the incorrect branch name. It's interesting that the branch-name normalization doesn't kick-in at all, it's not called it seems as it wouldn't be able to build a branch named And I put a test down and it's clear that the branch name it normalizes passes:
The culprit seems to be the trailing |
I made some improvements and now the trailing As CI takes a moment, I will integrate the changes with GitButler tomorrow and see what will happen then when repeating this workflow. |
With the PR merged, the overall issue is unchanged except that the error is clearer, with something like Since the virtual-branch creation is intended, I think this issue can be resolved specifically if the sanitization is improved. As implementing this will be a bit more effort, I will submit another PR to just fix the specific problem here, the tailing |
This is a quick-fix for a specific case, even though the actual fix should be offering branch normalization as part of the validation.
Now that normalization succeeds, it looks better, here is how this looks like
It's notable that the above would only work after I removed all the stray Please also note that all the improvements done so far are probably not satisfactory from a UX perspective. |
I experienced this situation yesterday. Is there a way we can make use of I had a very unexpected result in one of my testing, so I am wondering if I should avoid this in GB and spin up a |
Hiding the Maybe it would be easier to close GB while performing the I hope one of these options works for you. |
Ok, I followed the recommendation to do the revert in a separate local branch, then apply it. However, I would also appreciate a more direct way to handle this in GitButler. GB makes it easy to update and rebase, but I made the mistake of making some additional local changes before I tested against the update. Once I realized, I tried to "Revert" in the GB history, but that took my whole working tree back to the state prior to the "Update", and would have lost those additional changes. |
Version
0.12.16
Operating System
Windows
Distribution Method
msi (Windows)
Describe the issue
I ran
git revert {some-commit-id}
. The revert was correctly added to the virtual branch. However, there was another branch created.Now I cannot work with git butler any more, because it complains
How to reproduce
Use
git revert {some comit it}
Expected behavior
The virtual branch
Revert "..."
is not created at all.Relevant log output
No response
The text was updated successfully, but these errors were encountered: