summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Shin <shinhs0506@gmail.com>2023-01-18 08:14:03 -0800
committerJesse Duffield <jessedduffield@gmail.com>2023-03-20 20:13:59 +1100
commit776d8f4d2e4afff3c80a16c33ad28780e41169e6 (patch)
treea1d033af48e3d811c2060b73ad746e7583b0f221
parent6127e487dd977dc4a5c5f12fc72cc70d9d6205d1 (diff)
refresh the staging panel on successful commit
apply formatting
-rw-r--r--pkg/gui/controllers.go4
-rw-r--r--pkg/integration/tests/commit/staged.go8
-rw-r--r--pkg/integration/tests/commit/staged_without_hooks.go8
3 files changed, 16 insertions, 4 deletions
diff --git a/pkg/gui/controllers.go b/pkg/gui/controllers.go
index d7f6647c7..790a6d98b 100644
--- a/pkg/gui/controllers.go
+++ b/pkg/gui/controllers.go
@@ -9,6 +9,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers"
"github.com/jesseduffield/lazygit/pkg/gui/modes/cherrypicking"
"github.com/jesseduffield/lazygit/pkg/gui/services/custom_commands"
+ "github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/jesseduffield/lazygit/pkg/snake"
)
@@ -92,6 +93,9 @@ func (gui *Gui) resetControllers() {
onCommitSuccess := func() {
gui.State.savedCommitMessage = ""
+ _ = gui.c.Refresh(types.RefreshOptions{
+ Scope: []types.RefreshableView{types.STAGING},
+ })
}
commitMessageController := controllers.NewCommitMessageController(
diff --git a/pkg/integration/tests/commit/staged.go b/pkg/integration/tests/commit/staged.go
index 09bcf2815..f5e45995d 100644
--- a/pkg/integration/tests/commit/staged.go
+++ b/pkg/integration/tests/commit/staged.go
@@ -53,8 +53,12 @@ var Staged = NewIntegrationTest(NewIntegrationTestArgs{
Contains(commitMessage),
)
- t.Views().StagingSecondary().IsFocused()
+ t.Views().StagingSecondary().
+ IsEmpty()
- // TODO: assert that the staging panel has been refreshed (it currently does not get correctly refreshed)
+ t.Views().Staging().
+ IsFocused().
+ Content(Contains("+myfile content")).
+ Content(DoesNotContain("+with a second line"))
},
})
diff --git a/pkg/integration/tests/commit/staged_without_hooks.go b/pkg/integration/tests/commit/staged_without_hooks.go
index 620f712f9..dcf20d08d 100644
--- a/pkg/integration/tests/commit/staged_without_hooks.go
+++ b/pkg/integration/tests/commit/staged_without_hooks.go
@@ -53,8 +53,12 @@ var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{
Contains("WIP" + commitMessage),
)
- t.Views().StagingSecondary().IsFocused()
+ t.Views().StagingSecondary().
+ IsEmpty()
- // TODO: assert that the staging panel has been refreshed (it currently does not get correctly refreshed)
+ t.Views().Staging().
+ IsFocused().
+ Content(Contains("+myfile content")).
+ Content(DoesNotContain("+with a second line"))
},
})