-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Show todo items for pending cherry-picks and reverts #4442
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
base: continue-and-abort-for-revert-and-cherrypick
Are you sure you want to change the base?
Show todo items for pending cherry-picks and reverts #4442
Conversation
9d95aca
to
b3745fa
Compare
aa23d4d
to
cd2e83f
Compare
253b2f7
to
82ebc80
Compare
cd2e83f
to
a8eefbc
Compare
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
82ebc80
to
0badb30
Compare
a8eefbc
to
d88dd37
Compare
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
Wait I forgot I was looking at only a single commit. One moment while I review the rest |
0badb30
to
5d957ce
Compare
d88dd37
to
57d7c9e
Compare
Okay LGTM for real this time |
…basing This is equivalent in the current state of the code, but it will no longer be after the next commit, because we will introduce a new status value StatusConflicted. And in a later PR we might add yet another value StatusCherryPicking to distinguish rebase todos from cherry-pick todos; using commit.IsTODO is a safer way to check whether a commit is any of these.
…CT` instead It is useful to see if the conflicted commit was a "pick" or an "edit". What's more, we're about to add support for showing cherry-picks and reverts, and seeing that a conflicted commit was a revert is important because its diff is backwards compared to the diff of the conflicting files in the Files panel.
MergeRebasingCommits already merges the rebasing commits into the commits slice that is passed in, so it doesn't make sense to append the result to commits again. It isn't a problem, but only because commits is always empty.
This works correctly, we are only adding this as a regression test to verify that the change later in this branch doesn't break it.
…rebase This problem can't happen inside of lazygit itself right now, but this will change in the future. It will only happen when you stopped in an interactive rebase on an "edit" entry, and then you perform a revert or cherry-pick consisting of more than one commit; in this situation lazygit will show a conflict although there is none. This is not possible with lazygit yet, as we don't support range-select for reverting, and we don't use `git cherry-pick` for cherry-picking. Both will change in the future, so it's good to fix this bug.
What happens here is that when stopping on an "edit" todo entry, we rely on the assumption that if the .git/rebase-merge/amend file exists, the command was successful, and if it doesn't, there was a conflict. The problem is that when you stop on an edit command, and then run a multi-commit cherry-pick or rebase, this will delete the amend file. You may or may not consider this a bug in git; to work around it, we also check the existence of the rebase-merge/message file, which will be deleted as well by the cherry-pick or revert.
…ting We treat the .git/sequencer/todo file as read-only. Technically it seems it would be possible to treat it as modifiable in the same way as .git/rebase-merge/git-rebase-todo, effectively turning a cherry-pick or revert that stops at a conflict into an interactive rebase; however, git itself doesn't allow this (there is no "git cherry-pick --edit-todo"), so it seems safer not to rely on it. Theoretically it would be possible to allow modifying the rebase todos when a cherry-pick or revert conflicts in the middle of a rebase. However, it would introduce a bit of complexity to support this, as we would have to be able to distinguish between rebasing todos and cherry-picking/reverting todos, which we currently can't; it could also be a bit error-prone as far as edge cases are concerned. And it's really a pretty uncommon situation, so it doesn't seem worth it, and we just forbid all modifications to todos whenever we are cherry-picking or reverting.
5d957ce
to
2d897e1
Compare
57d7c9e
to
c1143a2
Compare
This is part two of a four part series of PRs that improve the cherry-pick and revert experience.
With this PR we include pending cherry-picks and reverts in the commit list (like rebase todos) when a cherry-pick or revert stops with conflicts; also, we show the conflicting item in the list like we do with conflicting rebase todos.
As with the previous PR, this is not really very useful yet because you can't revert a range of commits, and we don't use git cherry-pick for copy/paste. Both of these will change in later PRs in this series, so again this is preparation for that.
go generate ./...
)