Clear cherry-picked commits after pasting
It can be tedious after each cherry-pick opearation to clear the selection by pressing escape in order for lazygit to stop displaying info about copied commits. Also, it seems to be a rare case to cherry-pick commits to more than one destination. The simplest solution to address this issue is to clear the selection upon paste. The only exception is a merge conflict. Initially, I wanted to clear selected commits in this scenario too. During a discussion we found out that it may be convenient to have the copied commits still around. Aborting the rebase and pasting the commits in the middle of a branch can be a valid use case.
This commit is contained in:
committed by
Jesse Duffield
parent
761c77f5a2
commit
ee173ff7c9
@@ -59,26 +59,25 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Contains("base"),
|
||||
).
|
||||
Press(keys.Commits.PasteCommits).
|
||||
Tap(func() {
|
||||
// cherry-picked commits will be deleted after confirmation
|
||||
t.Views().Information().Content(Contains("2 commits copied"))
|
||||
}).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Alert().
|
||||
Title(Equals("Cherry-pick")).
|
||||
Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).
|
||||
Confirm()
|
||||
}).
|
||||
Tap(func() {
|
||||
t.Views().Information().Content(DoesNotContain("commits copied"))
|
||||
}).
|
||||
Lines(
|
||||
Contains("four"),
|
||||
Contains("three"),
|
||||
Contains("two"),
|
||||
Contains("one"),
|
||||
Contains("base"),
|
||||
).
|
||||
Tap(func() {
|
||||
// we need to manually exit out of cherry pick mode
|
||||
t.Views().Information().Content(Contains("2 commits copied"))
|
||||
}).
|
||||
PressEscape().
|
||||
Tap(func() {
|
||||
t.Views().Information().Content(DoesNotContain("commits copied"))
|
||||
})
|
||||
)
|
||||
},
|
||||
})
|
||||
|
||||
@@ -54,6 +54,10 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
t.Common().AcknowledgeConflicts()
|
||||
|
||||
// cherry pick selection is not cleared when there are conflicts, so that the user
|
||||
// is able to abort and try again without having to re-copy the commits
|
||||
t.Views().Information().Content(Contains("2 commits copied"))
|
||||
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
SelectedLine(Contains("file")).
|
||||
|
||||
@@ -68,6 +68,9 @@ var CherryPickDuringRebase = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).
|
||||
Confirm()
|
||||
}).
|
||||
Tap(func() {
|
||||
t.Views().Information().Content(DoesNotContain("commit copied"))
|
||||
}).
|
||||
Lines(
|
||||
Contains("pick CI two"),
|
||||
Contains("pick CI three"),
|
||||
|
||||
@@ -66,20 +66,15 @@ var CherryPickRange = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).
|
||||
Confirm()
|
||||
}).
|
||||
Tap(func() {
|
||||
t.Views().Information().Content(DoesNotContain("commits copied"))
|
||||
}).
|
||||
Lines(
|
||||
Contains("four"),
|
||||
Contains("three"),
|
||||
Contains("two"),
|
||||
Contains("one"),
|
||||
Contains("base"),
|
||||
).
|
||||
Tap(func() {
|
||||
// we need to manually exit out of cherry pick mode
|
||||
t.Views().Information().Content(Contains("2 commits copied"))
|
||||
}).
|
||||
PressEscape().
|
||||
Tap(func() {
|
||||
t.Views().Information().Content(DoesNotContain("commits copied"))
|
||||
})
|
||||
)
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user