diff --git a/pkg/integration/components/actions.go b/pkg/integration/components/actions.go index c599f3697..50564233a 100644 --- a/pkg/integration/components/actions.go +++ b/pkg/integration/components/actions.go @@ -31,3 +31,10 @@ func (self *Actions) ContinueOnConflictsResolved() { Content(Contains("all merge conflicts resolved. Continue?")). Confirm() } + +func (self *Actions) ConfirmDiscardLines() { + self.t.ExpectPopup().Confirmation(). + Title(Equals("Unstage lines")). + Content(Contains("Are you sure you want to delete the selected lines")). + Confirm() +} diff --git a/pkg/integration/components/commit_message_panel_driver.go b/pkg/integration/components/commit_message_panel_driver.go index a70688e73..b44a6c1dc 100644 --- a/pkg/integration/components/commit_message_panel_driver.go +++ b/pkg/integration/components/commit_message_panel_driver.go @@ -28,7 +28,21 @@ func (self *CommitMessagePanelDriver) AddNewline() *CommitMessagePanelDriver { } func (self *CommitMessagePanelDriver) Clear() *CommitMessagePanelDriver { - panic("Clear method not yet implemented!") + // clearing multiple times in case there's multiple lines + // (the clear button only clears a single line at a time) + maxAttempts := 100 + for i := 0; i < maxAttempts+1; i++ { + if self.getViewDriver().getView().Buffer() == "" { + break + } + + self.t.press(ClearKey) + if i == maxAttempts { + panic("failed to clear commit message panel") + } + } + + return self } func (self *CommitMessagePanelDriver) Confirm() { diff --git a/pkg/integration/components/test_driver.go b/pkg/integration/components/test_driver.go index e52cc8915..43618f23c 100644 --- a/pkg/integration/components/test_driver.go +++ b/pkg/integration/components/test_driver.go @@ -37,6 +37,13 @@ func (self *TestDriver) press(keyStr string) { self.gui.PressKey(keyStr) } +// Should only be used in specific cases where you're doing something weird! +// E.g. invoking a global keybinding from within a popup. +// You probably shouldn't use this function, and should instead go through a view like t.Views().Commit().Focus().Press(...) +func (self *TestDriver) GlobalPress(keyStr string) { + self.press(keyStr) +} + func (self *TestDriver) typeContent(content string) { for _, char := range content { self.press(string(char)) diff --git a/pkg/integration/tests/file/remember_commit_message_after_fail.go b/pkg/integration/tests/file/remember_commit_message_after_fail.go new file mode 100644 index 000000000..bb9b341b1 --- /dev/null +++ b/pkg/integration/tests/file/remember_commit_message_after_fail.go @@ -0,0 +1,62 @@ +package file + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var preCommitHook = `#!/bin/bash + +if [[ -f bad ]]; then + exit 1 +fi +` + +var RememberCommitMessageAfterFail = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Verify that the commit message is remembered after a failed attempt at committing", + ExtraCmdArgs: "", + Skip: false, + SetupConfig: func(config *config.AppConfig) { + }, + SetupRepo: func(shell *Shell) { + shell.CreateFile(".git/hooks/pre-commit", preCommitHook) + shell.RunCommand("chmod +x .git/hooks/pre-commit") + + shell.CreateFileAndAdd("one", "one") + + // the presence of this file will cause the pre-commit hook to fail + shell.CreateFile("bad", "bad") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Files(). + IsFocused(). + Lines( + Contains("bad"), + Contains("one"), + ). + Press(keys.Files.CommitChanges). + Tap(func() { + t.ExpectPopup().CommitMessagePanel().Type("my message").Confirm() + + t.ExpectPopup().Alert().Title(Equals("Error")).Content(Contains("Git command failed")).Confirm() + }). + Press(keys.Universal.Remove). // remove file that triggers pre-commit hook to fail + Tap(func() { + t.ExpectPopup().Menu().Title(Equals("bad")).Select(Contains("discard all changes")).Confirm() + }). + Lines( + Contains("one"), + ). + Press(keys.Files.CommitChanges). + Tap(func() { + t.ExpectPopup().CommitMessagePanel(). + InitialText(Equals("my message")). // it remembered the commit message + Confirm() + + t.Views().Commits(). + Lines( + Contains("my message"), + ) + }) + }, +}) diff --git a/pkg/integration/tests/staging/diff_context_change.go b/pkg/integration/tests/staging/diff_context_change.go new file mode 100644 index 000000000..8ddf3d37f --- /dev/null +++ b/pkg/integration/tests/staging/diff_context_change.go @@ -0,0 +1,80 @@ +package staging + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var DiffContextChange = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Change the number of diff context lines while in the staging panel", + ExtraCmdArgs: "", + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + // need to be working with a few lines so that git perceives it as two separate hunks + shell.CreateFileAndAdd("file1", "1a\n2a\n3a\n4a\n5a\n6a\n7a\n8a\n9a\n10a\n11a\n12a\n13a\n14a\n15a") + shell.Commit("one") + + shell.UpdateFile("file1", "1a\n2a\n3b\n4a\n5a\n6a\n7a\n8a\n9a\n10a\n11a\n12a\n13b\n14a\n15a") + + // hunk looks like: + // diff --git a/file1 b/file1 + // index 3653080..a6388b6 100644 + // --- a/file1 + // +++ b/file1 + // @@ -1,6 +1,6 @@ + // 1a + // 2a + // -3a + // +3b + // 4a + // 5a + // 6a + // @@ -10,6 +10,6 @@ + // 10a + // 11a + // 12a + // -13a + // +13b + // 14a + // 15a + // \ No newline at end of file + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Files(). + IsFocused(). + Lines( + Contains("file1").IsSelected(), + ). + PressEnter() + + t.Views().Staging(). + IsFocused(). + Content(Contains("@@ -1,6 +1,6 @@").DoesNotContain(" 7a")). + SelectedLine(Contains("-3a")). + Press(keys.Universal.IncreaseContextInDiffView). + // still on the same line + SelectedLine(Contains("-3a")). + // '7a' is now visible + Content(Contains("@@ -1,7 +1,7 @@").Contains(" 7a")). + Press(keys.Universal.DecreaseContextInDiffView). + SelectedLine(Contains("-3a")). + Content(Contains("@@ -1,6 +1,6 @@").DoesNotContain(" 7a")). + Press(keys.Universal.DecreaseContextInDiffView). + SelectedLine(Contains("-3a")). + Content(Contains("@@ -1,5 +1,5 @@").DoesNotContain(" 6a")). + Press(keys.Universal.DecreaseContextInDiffView). + // arguably we should still be on -3a, but at the moment the logic puts us on on +3b + SelectedLine(Contains("+3b")). + Content(Contains("@@ -2,3 +2,3 @@").DoesNotContain(" 5a")). + PressPrimaryAction(). + Content(DoesNotContain("+3b")). + Press(keys.Universal.TogglePanel) + + t.Views().StagingSecondary(). + IsFocused(). + Content(Contains("@@ -3,2 +3,3 @@\n 3a\n+3b\n 4a")). + Press(keys.Universal.IncreaseContextInDiffView). + Content(Contains("@@ -2,4 +2,5 @@\n 2a\n 3a\n+3b\n 4a\n 5a")) + }, +}) diff --git a/pkg/integration/tests/staging/discard_all_changes.go b/pkg/integration/tests/staging/discard_all_changes.go new file mode 100644 index 000000000..7d27e7ec2 --- /dev/null +++ b/pkg/integration/tests/staging/discard_all_changes.go @@ -0,0 +1,54 @@ +package staging + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var DiscardAllChanges = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Discard all changes of a file in the staging panel, then assert we land in the staging panel of the next file", + ExtraCmdArgs: "", + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.CreateFileAndAdd("file1", "one\ntwo\n") + shell.CreateFileAndAdd("file2", "1\n2\n") + shell.Commit("one") + + shell.UpdateFile("file1", "one\ntwo\nthree\nfour\n") + shell.UpdateFile("file2", "1\n2\n3\n4\n") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Files(). + IsFocused(). + Lines( + Contains("file1").IsSelected(), + Contains("file2"), + ). + PressEnter() + + t.Views().Staging(). + IsFocused(). + SelectedLine(Contains("+three")). + // discard the line + Press(keys.Universal.Remove). + Tap(func() { + t.Actions().ConfirmDiscardLines() + }). + SelectedLine(Contains("+four")). + // discard the other line + Press(keys.Universal.Remove). + Tap(func() { + t.Actions().ConfirmDiscardLines() + + // because there are no more changes in file1 we switch to file2 + t.Views().Files(). + Lines( + Contains("file2").IsSelected(), + ) + }). + // assert we are still in the staging panel, but now looking at the changes of the other file + IsFocused(). + SelectedLine(Contains("+3")) + }, +}) diff --git a/pkg/integration/tests/staging/stage_hunks.go b/pkg/integration/tests/staging/stage_hunks.go new file mode 100644 index 000000000..b79819108 --- /dev/null +++ b/pkg/integration/tests/staging/stage_hunks.go @@ -0,0 +1,91 @@ +package staging + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var StageHunks = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Stage and unstage various hunks of a file in the staging panel", + ExtraCmdArgs: "", + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + // need to be working with a few lines so that git perceives it as two separate hunks + shell.CreateFileAndAdd("file1", "1a\n2a\n3a\n4a\n5a\n6a\n7a\n8a\n9a\n10a\n11a\n12a\n13a\n14a\n15a") + shell.Commit("one") + + shell.UpdateFile("file1", "1a\n2a\n3b\n4a\n5a\n6a\n7a\n8a\n9a\n10a\n11a\n12a\n13b\n14a\n15a") + + // hunk looks like: + // diff --git a/file1 b/file1 + // index 3653080..a6388b6 100644 + // --- a/file1 + // +++ b/file1 + // @@ -1,6 +1,6 @@ + // 1a + // 2a + // -3a + // +3b + // 4a + // 5a + // 6a + // @@ -10,6 +10,6 @@ + // 10a + // 11a + // 12a + // -13a + // +13b + // 14a + // 15a + // \ No newline at end of file + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Files(). + IsFocused(). + Lines( + Contains("file1").IsSelected(), + ). + PressEnter() + + t.Views().Staging(). + IsFocused(). + SelectedLine(Contains("-3a")). + Press(keys.Universal.NextBlock). + SelectedLine(Contains("-13a")). + Press(keys.Main.ToggleSelectHunk). + // when in hunk mode, pressing up/down moves us up/down by a hunk + SelectPreviousItem(). + SelectedLine(Contains("-3a")). + SelectNextItem(). + SelectedLine(Contains("-13a")). + // stage the second hunk + PressPrimaryAction(). + Content(Contains("-3a\n+3b")). + Tap(func() { + t.Views().StagingSecondary(). + Content(Contains("-13a\n+13b")) + }). + Press(keys.Universal.TogglePanel) + + t.Views().StagingSecondary(). + IsFocused(). + SelectedLine(Contains("-13a")). + // after toggling panel, we're back to only having selected a single line + PressPrimaryAction(). + SelectedLine(Contains("+13b")). + PressPrimaryAction(). + IsEmpty() + + t.Views().Staging(). + IsFocused(). + SelectedLine(Contains("-3a")). + Press(keys.Main.ToggleSelectHunk). + Press(keys.Universal.Remove). + Tap(func() { + t.Actions().ConfirmDiscardLines() + }). + SelectedLine(Contains("-13a")). + Content(DoesNotContain("-3a").DoesNotContain("+3b")) + }, +}) diff --git a/pkg/integration/tests/staging/stage_lines.go b/pkg/integration/tests/staging/stage_lines.go new file mode 100644 index 000000000..f1777fb36 --- /dev/null +++ b/pkg/integration/tests/staging/stage_lines.go @@ -0,0 +1,108 @@ +package staging + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var StageLines = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Stage and unstage various lines of a file in the staging panel", + ExtraCmdArgs: "", + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.CreateFileAndAdd("file1", "one\ntwo\n") + shell.Commit("one") + + shell.UpdateFile("file1", "one\ntwo\nthree\nfour\n") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Files(). + IsFocused(). + Lines( + Contains("file1").IsSelected(), + ). + PressEnter() + + t.Views().Staging(). + IsFocused(). + SelectedLine(Contains("+three")). + // stage 'three' + PressPrimaryAction(). + // 'three' moves over to the staging secondary panel + Content(DoesNotContain("+three")). + Tap(func() { + t.Views().StagingSecondary(). + Content(Contains("+three")) + }). + SelectedLine(Contains("+four")). + // stage 'four' + PressPrimaryAction(). + // nothing left in our staging panel + IsEmpty() + + // because we've staged everything we get moved to the staging secondary panel + // do the same thing as above, moving the lines back to the staging panel + t.Views().StagingSecondary(). + IsFocused(). + Content(Contains("+three\n+four")). + SelectedLine(Contains("+three")). + PressPrimaryAction(). + Content(DoesNotContain("+three")). + Tap(func() { + t.Views().Staging(). + Content(Contains("+three")) + }). + SelectedLine(Contains("+four")). + // pressing 'remove' has the same effect as pressing space when in the staging secondary panel + Press(keys.Universal.Remove). + IsEmpty() + + // stage one line and then manually toggle to the staging secondary panel + t.Views().Staging(). + IsFocused(). + Content(Contains("+three\n+four")). + SelectedLine(Contains("+three")). + PressPrimaryAction(). + Content(DoesNotContain("+three")). + Tap(func() { + t.Views().StagingSecondary(). + Content(Contains("+three")) + }). + Press(keys.Universal.TogglePanel) + + // manually toggle back to the staging panel + t.Views().StagingSecondary(). + IsFocused(). + Press(keys.Universal.TogglePanel) + + t.Views().Staging(). + SelectedLine(Contains("+four")). + // discard the line + Press(keys.Universal.Remove). + Tap(func() { + t.ExpectPopup().Confirmation(). + Title(Equals("Unstage lines")). + Content(Contains("Are you sure you want to delete the selected lines")). + Confirm() + }). + IsEmpty() + + t.Views().StagingSecondary(). + IsFocused(). + Content(Contains("+three\n")). + // return to file + PressEscape() + + t.Views().Files(). + IsFocused(). + Lines( + Contains("M file1").IsSelected(), + ). + PressEnter() + + // because we only have a staged change we'll land in the staging secondary panel + t.Views().StagingSecondary(). + IsFocused() + }, +}) diff --git a/pkg/integration/tests/staging/stage_ranges.go b/pkg/integration/tests/staging/stage_ranges.go new file mode 100644 index 000000000..cd6d8021f --- /dev/null +++ b/pkg/integration/tests/staging/stage_ranges.go @@ -0,0 +1,75 @@ +package staging + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var StageRanges = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Stage and unstage various ranges of a file in the staging panel", + ExtraCmdArgs: "", + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.CreateFileAndAdd("file1", "one\ntwo\n") + shell.Commit("one") + + shell.UpdateFile("file1", "one\ntwo\nthree\nfour\nfive\nsix\n") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Files(). + IsFocused(). + Lines( + Contains("file1").IsSelected(), + ). + PressEnter() + + t.Views().Staging(). + IsFocused(). + SelectedLine(Contains("+three")). + Press(keys.Main.ToggleDragSelect). + SelectNextItem(). + SelectedLine(Contains("+four")). + SelectNextItem(). + SelectedLine(Contains("+five")). + // stage the three lines we've just selected + PressPrimaryAction(). + Content(Contains(" five\n+six")). + Tap(func() { + t.Views().StagingSecondary(). + Content(Contains("+three\n+four\n+five")) + }). + Press(keys.Universal.TogglePanel) + + t.Views().StagingSecondary(). + IsFocused(). + SelectedLine(Contains("+three")). + Press(keys.Main.ToggleDragSelect). + SelectNextItem(). + SelectedLine(Contains("+four")). + SelectNextItem(). + SelectedLine(Contains("+five")). + // unstage the three selected lines + PressPrimaryAction(). + // nothing left in our staging secondary panel + IsEmpty(). + Tap(func() { + t.Views().Staging(). + Content(Contains("+three\n+four\n+five\n+six")) + }) + + t.Views().Staging(). + IsFocused(). + // coincidentally we land at '+four' here. Maybe we should instead land + // at '+three'? given it's at the start of the hunk? + SelectedLine(Contains("+four")). + Press(keys.Main.ToggleDragSelect). + SelectNextItem(). + SelectedLine(Contains("+five")). + Press(keys.Universal.Remove). + Tap(func() { + t.Actions().ConfirmDiscardLines() + }). + Content(Contains("+three\n+six")) + }, +}) diff --git a/pkg/integration/tests/tests_gen.go b/pkg/integration/tests/tests_gen.go index c99870d43..6814ae631 100644 --- a/pkg/integration/tests/tests_gen.go +++ b/pkg/integration/tests/tests_gen.go @@ -73,6 +73,7 @@ var tests = []*components.IntegrationTest{ file.DiscardChanges, file.DiscardStagedChanges, file.Gitignore, + file.RememberCommitMessageAfterFail, filter_by_path.CliArg, filter_by_path.SelectFile, filter_by_path.TypeFile, @@ -98,7 +99,12 @@ var tests = []*components.IntegrationTest{ reflog.CherryPick, reflog.Patch, reflog.Reset, + staging.DiffContextChange, + staging.DiscardAllChanges, staging.Search, + staging.StageHunks, + staging.StageLines, + staging.StageRanges, stash.Apply, stash.ApplyPatch, stash.CreateBranch, @@ -139,6 +145,7 @@ var tests = []*components.IntegrationTest{ tag.CrudAnnotated, tag.CrudLightweight, tag.Reset, + ui.DoublePopup, ui.SwitchTabFromMenu, undo.UndoCheckoutAndDrop, undo.UndoDrop, diff --git a/pkg/integration/tests/ui/double_popup.go b/pkg/integration/tests/ui/double_popup.go new file mode 100644 index 000000000..85ba4309e --- /dev/null +++ b/pkg/integration/tests/ui/double_popup.go @@ -0,0 +1,34 @@ +package ui + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var DoublePopup = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Open a popup from within another popup and assert you can escape back to the side panels", + ExtraCmdArgs: "", + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.EmptyCommit("one") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Branches(). + Focus(). + // arbitrarily bringing up a popup + PressPrimaryAction() + + t.ExpectPopup().Alert(). + Title(Contains("Error")). + Content(Contains("You have already checked out this branch")) + + t.GlobalPress(keys.Universal.OpenRecentRepos) + + t.ExpectPopup().Menu().Title(Contains("recent repositories")).Cancel() + + t.Views().Branches().IsFocused() + + t.Views().Files().Focus() + }, +}) diff --git a/test/integration/popupFocus/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration/popupFocus/expected/repo/.git_keep/COMMIT_EDITMSG deleted file mode 100644 index 00d7bdd40..000000000 --- a/test/integration/popupFocus/expected/repo/.git_keep/COMMIT_EDITMSG +++ /dev/null @@ -1 +0,0 @@ -WIP diff --git a/test/integration/popupFocus/expected/repo/.git_keep/FETCH_HEAD b/test/integration/popupFocus/expected/repo/.git_keep/FETCH_HEAD deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/integration/popupFocus/expected/repo/.git_keep/HEAD b/test/integration/popupFocus/expected/repo/.git_keep/HEAD deleted file mode 100644 index cb089cd89..000000000 --- a/test/integration/popupFocus/expected/repo/.git_keep/HEAD +++ /dev/null @@ -1 +0,0 @@ -ref: refs/heads/master diff --git a/test/integration/popupFocus/expected/repo/.git_keep/config b/test/integration/popupFocus/expected/repo/.git_keep/config deleted file mode 100644 index 8ae104545..000000000 --- a/test/integration/popupFocus/expected/repo/.git_keep/config +++ /dev/null @@ -1,10 +0,0 @@ -[core] - repositoryformatversion = 0 - filemode = true - bare = false - logallrefupdates = true - ignorecase = true - precomposeunicode = true -[user] - email = CI@example.com - name = CI diff --git a/test/integration/popupFocus/expected/repo/.git_keep/description b/test/integration/popupFocus/expected/repo/.git_keep/description deleted file mode 100644 index 498b267a8..000000000 --- a/test/integration/popupFocus/expected/repo/.git_keep/description +++ /dev/null @@ -1 +0,0 @@ -Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/popupFocus/expected/repo/.git_keep/index b/test/integration/popupFocus/expected/repo/.git_keep/index deleted file mode 100644 index d74d35efa..000000000 Binary files a/test/integration/popupFocus/expected/repo/.git_keep/index and /dev/null differ diff --git a/test/integration/popupFocus/expected/repo/.git_keep/info/exclude b/test/integration/popupFocus/expected/repo/.git_keep/info/exclude deleted file mode 100644 index 8e9f2071f..000000000 --- a/test/integration/popupFocus/expected/repo/.git_keep/info/exclude +++ /dev/null @@ -1,7 +0,0 @@ -# git ls-files --others --exclude-from=.git/info/exclude -# Lines that start with '#' are comments. -# For a project mostly in C, the following would be a good set of -# exclude patterns (uncomment them if you want to use them): -# *.[oa] -# *~ -.DS_Store diff --git a/test/integration/popupFocus/expected/repo/.git_keep/logs/HEAD b/test/integration/popupFocus/expected/repo/.git_keep/logs/HEAD deleted file mode 100644 index 03b354937..000000000 --- a/test/integration/popupFocus/expected/repo/.git_keep/logs/HEAD +++ /dev/null @@ -1,3 +0,0 @@ -0000000000000000000000000000000000000000 353cce986c61f361452f43522426c120b4ee9461 CI 1659355870 +1000 commit (initial): myfile1 -353cce986c61f361452f43522426c120b4ee9461 6ecdae79ff53548670039abee9008b6bb36cdf4f CI 1659355870 +1000 commit: myfile2 -6ecdae79ff53548670039abee9008b6bb36cdf4f 0478d727ea0ebf57ed9ca85acef9e60a324d86f0 CI 1659355876 +1000 commit: WIP diff --git a/test/integration/popupFocus/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/popupFocus/expected/repo/.git_keep/logs/refs/heads/master deleted file mode 100644 index 03b354937..000000000 --- a/test/integration/popupFocus/expected/repo/.git_keep/logs/refs/heads/master +++ /dev/null @@ -1,3 +0,0 @@ -0000000000000000000000000000000000000000 353cce986c61f361452f43522426c120b4ee9461 CI 1659355870 +1000 commit (initial): myfile1 -353cce986c61f361452f43522426c120b4ee9461 6ecdae79ff53548670039abee9008b6bb36cdf4f CI 1659355870 +1000 commit: myfile2 -6ecdae79ff53548670039abee9008b6bb36cdf4f 0478d727ea0ebf57ed9ca85acef9e60a324d86f0 CI 1659355876 +1000 commit: WIP diff --git a/test/integration/popupFocus/expected/repo/.git_keep/objects/04/78d727ea0ebf57ed9ca85acef9e60a324d86f0 b/test/integration/popupFocus/expected/repo/.git_keep/objects/04/78d727ea0ebf57ed9ca85acef9e60a324d86f0 deleted file mode 100644 index 1a59d8559..000000000 --- a/test/integration/popupFocus/expected/repo/.git_keep/objects/04/78d727ea0ebf57ed9ca85acef9e60a324d86f0 +++ /dev/null @@ -1,3 +0,0 @@ -x -0E]+f/ȤӼ@D;w -Ɩ7pl`.C8zHy$ռX҈ ف]_] %$UGn> RE$!K!=&ca \ No newline at end of file diff --git a/test/integration/popupFocus/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/popupFocus/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 deleted file mode 100644 index 285df3e5f..000000000 Binary files a/test/integration/popupFocus/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 and /dev/null differ diff --git a/test/integration/popupFocus/expected/repo/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/popupFocus/expected/repo/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 deleted file mode 100644 index 96d2e71a6..000000000 Binary files a/test/integration/popupFocus/expected/repo/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 and /dev/null differ diff --git a/test/integration/popupFocus/expected/repo/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/popupFocus/expected/repo/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b deleted file mode 100644 index 9b771fc2f..000000000 Binary files a/test/integration/popupFocus/expected/repo/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b and /dev/null differ diff --git a/test/integration/popupFocus/expected/repo/.git_keep/refs/heads/master b/test/integration/popupFocus/expected/repo/.git_keep/refs/heads/master deleted file mode 100644 index 6ffdf61da..000000000 --- a/test/integration/popupFocus/expected/repo/.git_keep/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -0478d727ea0ebf57ed9ca85acef9e60a324d86f0 diff --git a/test/integration/popupFocus/expected/repo/myfile1 b/test/integration/popupFocus/expected/repo/myfile1 deleted file mode 100644 index a5bce3fd2..000000000 --- a/test/integration/popupFocus/expected/repo/myfile1 +++ /dev/null @@ -1 +0,0 @@ -test1 diff --git a/test/integration/popupFocus/expected/repo/myfile2 b/test/integration/popupFocus/expected/repo/myfile2 deleted file mode 100644 index 180cf8328..000000000 --- a/test/integration/popupFocus/expected/repo/myfile2 +++ /dev/null @@ -1 +0,0 @@ -test2 diff --git a/test/integration/popupFocus/expected/repo/myfile3 b/test/integration/popupFocus/expected/repo/myfile3 deleted file mode 100644 index df6b0d2bc..000000000 --- a/test/integration/popupFocus/expected/repo/myfile3 +++ /dev/null @@ -1 +0,0 @@ -test3 diff --git a/test/integration/popupFocus/recording.json b/test/integration/popupFocus/recording.json deleted file mode 100644 index e7f4f9d53..000000000 --- a/test/integration/popupFocus/recording.json +++ /dev/null @@ -1 +0,0 @@ -{"KeyEvents":[{"Timestamp":607,"Mod":0,"Key":259,"Ch":0},{"Timestamp":745,"Mod":0,"Key":259,"Ch":0},{"Timestamp":1304,"Mod":0,"Key":256,"Ch":82},{"Timestamp":2087,"Mod":2,"Key":18,"Ch":18},{"Timestamp":2894,"Mod":0,"Key":27,"Ch":0},{"Timestamp":3553,"Mod":0,"Key":260,"Ch":0},{"Timestamp":3697,"Mod":0,"Key":260,"Ch":0},{"Timestamp":4064,"Mod":0,"Key":256,"Ch":32},{"Timestamp":4376,"Mod":0,"Key":256,"Ch":119},{"Timestamp":4745,"Mod":0,"Key":13,"Ch":13},{"Timestamp":5200,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":238,"Height":61}]} \ No newline at end of file diff --git a/test/integration/popupFocus/setup.sh b/test/integration/popupFocus/setup.sh deleted file mode 100644 index b22a9c241..000000000 --- a/test/integration/popupFocus/setup.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -set -e - -cd $1 - -git init - -git config user.email "CI@example.com" -git config user.name "CI" - -echo test1 > myfile1 -git add . -git commit -am "myfile1" -echo test2 > myfile2 -git add . -git commit -am "myfile2" -echo test3 > myfile3 diff --git a/test/integration/popupFocus/test.json b/test/integration/popupFocus/test.json deleted file mode 100644 index 60bfe9319..000000000 --- a/test/integration/popupFocus/test.json +++ /dev/null @@ -1 +0,0 @@ -{ "description": "stage a file and commit the change", "speed": 15 } diff --git a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/COMMIT_EDITMSG deleted file mode 100644 index 2ff0cc013..000000000 --- a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/COMMIT_EDITMSG +++ /dev/null @@ -1 +0,0 @@ -second commit diff --git a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/FETCH_HEAD b/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/FETCH_HEAD deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/HEAD b/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/HEAD deleted file mode 100644 index cb089cd89..000000000 --- a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/HEAD +++ /dev/null @@ -1 +0,0 @@ -ref: refs/heads/master diff --git a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/config b/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/config deleted file mode 100644 index 596ebaeb3..000000000 --- a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/config +++ /dev/null @@ -1,8 +0,0 @@ -[core] - repositoryformatversion = 0 - filemode = true - bare = false - logallrefupdates = true -[user] - email = CI@example.com - name = CI diff --git a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/description b/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/description deleted file mode 100644 index 498b267a8..000000000 --- a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/description +++ /dev/null @@ -1 +0,0 @@ -Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/index b/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/index deleted file mode 100644 index d31935681..000000000 Binary files a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/index and /dev/null differ diff --git a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/info/exclude b/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/info/exclude deleted file mode 100644 index a5196d1be..000000000 --- a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/info/exclude +++ /dev/null @@ -1,6 +0,0 @@ -# git ls-files --others --exclude-from=.git/info/exclude -# Lines that start with '#' are comments. -# For a project mostly in C, the following would be a good set of -# exclude patterns (uncomment them if you want to use them): -# *.[oa] -# *~ diff --git a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/logs/HEAD b/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/logs/HEAD deleted file mode 100644 index 2bf564e5f..000000000 --- a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/logs/HEAD +++ /dev/null @@ -1,2 +0,0 @@ -0000000000000000000000000000000000000000 c2bf9b666a310383fd7095bc5bd993bba11b040e CI 1640438057 +0100 commit (initial): first commit -c2bf9b666a310383fd7095bc5bd993bba11b040e d0ce4cb10cd926f646a08889b077a6d7eddd3534 CI 1640438062 +0100 commit: second commit diff --git a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/logs/refs/heads/master deleted file mode 100644 index 2bf564e5f..000000000 --- a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/logs/refs/heads/master +++ /dev/null @@ -1,2 +0,0 @@ -0000000000000000000000000000000000000000 c2bf9b666a310383fd7095bc5bd993bba11b040e CI 1640438057 +0100 commit (initial): first commit -c2bf9b666a310383fd7095bc5bd993bba11b040e d0ce4cb10cd926f646a08889b077a6d7eddd3534 CI 1640438062 +0100 commit: second commit diff --git a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/objects/6c/493ff740f9380390d5c9ddef4af18697ac9375 b/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/objects/6c/493ff740f9380390d5c9ddef4af18697ac9375 deleted file mode 100644 index 7d217a785..000000000 Binary files a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/objects/6c/493ff740f9380390d5c9ddef4af18697ac9375 and /dev/null differ diff --git a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/objects/ae/ac8b060acee50f309eb1f6698a981c50bdf493 b/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/objects/ae/ac8b060acee50f309eb1f6698a981c50bdf493 deleted file mode 100644 index 9806bc4bd..000000000 Binary files a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/objects/ae/ac8b060acee50f309eb1f6698a981c50bdf493 and /dev/null differ diff --git a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/objects/c2/bf9b666a310383fd7095bc5bd993bba11b040e b/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/objects/c2/bf9b666a310383fd7095bc5bd993bba11b040e deleted file mode 100644 index e92225048..000000000 Binary files a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/objects/c2/bf9b666a310383fd7095bc5bd993bba11b040e and /dev/null differ diff --git a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/objects/c9/62a96f68e65b4dc8e0fea12db5f9006091efdf b/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/objects/c9/62a96f68e65b4dc8e0fea12db5f9006091efdf deleted file mode 100644 index 285462492..000000000 Binary files a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/objects/c9/62a96f68e65b4dc8e0fea12db5f9006091efdf and /dev/null differ diff --git a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/objects/d0/ce4cb10cd926f646a08889b077a6d7eddd3534 b/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/objects/d0/ce4cb10cd926f646a08889b077a6d7eddd3534 deleted file mode 100644 index 76baa3646..000000000 Binary files a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/objects/d0/ce4cb10cd926f646a08889b077a6d7eddd3534 and /dev/null differ diff --git a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/objects/e2/129701f1a4d54dc44f03c93bca0a2aec7c5449 b/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/objects/e2/129701f1a4d54dc44f03c93bca0a2aec7c5449 deleted file mode 100644 index 08245d001..000000000 Binary files a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/objects/e2/129701f1a4d54dc44f03c93bca0a2aec7c5449 and /dev/null differ diff --git a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/refs/heads/master b/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/refs/heads/master deleted file mode 100644 index 13943fa1b..000000000 --- a/test/integration/rememberCommitMessageAfterFail/expected/repo/.git_keep/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -d0ce4cb10cd926f646a08889b077a6d7eddd3534 diff --git a/test/integration/rememberCommitMessageAfterFail/expected/repo/file1 b/test/integration/rememberCommitMessageAfterFail/expected/repo/file1 deleted file mode 100644 index e2129701f..000000000 --- a/test/integration/rememberCommitMessageAfterFail/expected/repo/file1 +++ /dev/null @@ -1 +0,0 @@ -file1 diff --git a/test/integration/rememberCommitMessageAfterFail/expected/repo/file2 b/test/integration/rememberCommitMessageAfterFail/expected/repo/file2 deleted file mode 100644 index 6c493ff74..000000000 --- a/test/integration/rememberCommitMessageAfterFail/expected/repo/file2 +++ /dev/null @@ -1 +0,0 @@ -file2 diff --git a/test/integration/rememberCommitMessageAfterFail/recording.json b/test/integration/rememberCommitMessageAfterFail/recording.json deleted file mode 100644 index 39d0fcfa0..000000000 --- a/test/integration/rememberCommitMessageAfterFail/recording.json +++ /dev/null @@ -1 +0,0 @@ -{"KeyEvents":[{"Timestamp":1360,"Mod":0,"Key":256,"Ch":106},{"Timestamp":2124,"Mod":0,"Key":256,"Ch":32},{"Timestamp":4000,"Mod":0,"Key":256,"Ch":99},{"Timestamp":4595,"Mod":0,"Key":256,"Ch":102},{"Timestamp":4730,"Mod":0,"Key":256,"Ch":105},{"Timestamp":4831,"Mod":0,"Key":256,"Ch":114},{"Timestamp":5011,"Mod":0,"Key":256,"Ch":115},{"Timestamp":5122,"Mod":0,"Key":256,"Ch":116},{"Timestamp":5552,"Mod":0,"Key":256,"Ch":32},{"Timestamp":5778,"Mod":0,"Key":256,"Ch":99},{"Timestamp":5882,"Mod":0,"Key":256,"Ch":111},{"Timestamp":6046,"Mod":0,"Key":256,"Ch":109},{"Timestamp":6212,"Mod":0,"Key":256,"Ch":109},{"Timestamp":6449,"Mod":0,"Key":256,"Ch":105},{"Timestamp":6550,"Mod":0,"Key":256,"Ch":116},{"Timestamp":7347,"Mod":0,"Key":13,"Ch":13},{"Timestamp":9314,"Mod":0,"Key":13,"Ch":13},{"Timestamp":10322,"Mod":0,"Key":256,"Ch":107},{"Timestamp":11012,"Mod":0,"Key":256,"Ch":100},{"Timestamp":11547,"Mod":0,"Key":13,"Ch":13},{"Timestamp":12960,"Mod":0,"Key":256,"Ch":99},{"Timestamp":13863,"Mod":0,"Key":13,"Ch":13},{"Timestamp":15574,"Mod":0,"Key":256,"Ch":32},{"Timestamp":16365,"Mod":0,"Key":256,"Ch":99},{"Timestamp":16977,"Mod":0,"Key":256,"Ch":115},{"Timestamp":17111,"Mod":0,"Key":256,"Ch":101},{"Timestamp":17308,"Mod":0,"Key":256,"Ch":99},{"Timestamp":17420,"Mod":0,"Key":256,"Ch":111},{"Timestamp":17442,"Mod":0,"Key":256,"Ch":110},{"Timestamp":17593,"Mod":0,"Key":256,"Ch":100},{"Timestamp":17814,"Mod":0,"Key":256,"Ch":32},{"Timestamp":18040,"Mod":0,"Key":256,"Ch":99},{"Timestamp":18127,"Mod":0,"Key":256,"Ch":111},{"Timestamp":18269,"Mod":0,"Key":256,"Ch":109},{"Timestamp":18409,"Mod":0,"Key":256,"Ch":109},{"Timestamp":18694,"Mod":0,"Key":256,"Ch":105},{"Timestamp":18803,"Mod":0,"Key":256,"Ch":116},{"Timestamp":19624,"Mod":0,"Key":13,"Ch":13},{"Timestamp":21204,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":212,"Height":55}]} \ No newline at end of file diff --git a/test/integration/rememberCommitMessageAfterFail/setup.sh b/test/integration/rememberCommitMessageAfterFail/setup.sh deleted file mode 100644 index 0ac33d4c9..000000000 --- a/test/integration/rememberCommitMessageAfterFail/setup.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -set -e - -cd $1 - -git init -git config user.email "CI@example.com" -git config user.name "CI" - -git checkout -b master - -echo "file1" > file1 -echo "file2" > file2 -echo "disruptive" > disruptive -cat > .git/hooks/pre-commit < 1642499804 +1100 commit (initial): file1 diff --git a/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/logs/refs/heads/master deleted file mode 100644 index 731f404f9..000000000 --- a/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/logs/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -0000000000000000000000000000000000000000 1854ab416d299cda0227d62b9ab0765e5551ef57 CI 1642499804 +1100 commit (initial): file1 diff --git a/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/objects/15/8e9a9c1a9627ea0ef4de8b00a503ed0f80a09e b/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/objects/15/8e9a9c1a9627ea0ef4de8b00a503ed0f80a09e deleted file mode 100644 index 2c00719b0..000000000 Binary files a/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/objects/15/8e9a9c1a9627ea0ef4de8b00a503ed0f80a09e and /dev/null differ diff --git a/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/objects/18/54ab416d299cda0227d62b9ab0765e5551ef57 b/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/objects/18/54ab416d299cda0227d62b9ab0765e5551ef57 deleted file mode 100644 index efdc77489..000000000 Binary files a/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/objects/18/54ab416d299cda0227d62b9ab0765e5551ef57 and /dev/null differ diff --git a/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/objects/2c/484c0a45f3726375600319f73978221a74b783 b/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/objects/2c/484c0a45f3726375600319f73978221a74b783 deleted file mode 100644 index 342ac1eb8..000000000 Binary files a/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/objects/2c/484c0a45f3726375600319f73978221a74b783 and /dev/null differ diff --git a/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/objects/7b/9c2149f16c706cea79b03234cb67fde7e9b68f b/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/objects/7b/9c2149f16c706cea79b03234cb67fde7e9b68f deleted file mode 100644 index 611ed37a4..000000000 Binary files a/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/objects/7b/9c2149f16c706cea79b03234cb67fde7e9b68f and /dev/null differ diff --git a/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/objects/8a/af931e5367e5af9d2e2c014800d22190352b14 b/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/objects/8a/af931e5367e5af9d2e2c014800d22190352b14 deleted file mode 100644 index cb168bb1d..000000000 Binary files a/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/objects/8a/af931e5367e5af9d2e2c014800d22190352b14 and /dev/null differ diff --git a/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/objects/fd/c28832bb15c80146150a24a018088c9df4f8cd b/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/objects/fd/c28832bb15c80146150a24a018088c9df4f8cd deleted file mode 100644 index af8771ae4..000000000 Binary files a/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/objects/fd/c28832bb15c80146150a24a018088c9df4f8cd and /dev/null differ diff --git a/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/refs/heads/master b/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/refs/heads/master deleted file mode 100644 index c5cccb127..000000000 --- a/test/integration/staginWithDiffContextChange/expected/repo/.git_keep/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -1854ab416d299cda0227d62b9ab0765e5551ef57 diff --git a/test/integration/staginWithDiffContextChange/expected/repo/one.txt b/test/integration/staginWithDiffContextChange/expected/repo/one.txt deleted file mode 100644 index c3323cfc9..000000000 --- a/test/integration/staginWithDiffContextChange/expected/repo/one.txt +++ /dev/null @@ -1,67 +0,0 @@ -package oscommands - -import ( - "github.com/jesseduffield/lazygit/pkg/common" - "github.com/jesseduffield/lazygit/pkg/utils" -) - -// NewDummyOSCommand creates a new dummy OSCommand for testing -func NewDummyOSCommand() *OSCommand { - osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - - return osCmd -} - -type OSCommandDeps struct { - Common *common.Common - Platform *Platform - GetenvFn func(string) string - RemoveFileFn func(string) error - Cmd *CmdObjBuilder -} - -func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand { - if deps.Cmd == nil { - panic("WHAT") - } - common := deps.Common - if common == nil { - common = utils.NewDummyCommon() - } - - platform := deps.Platform - if platform == nil { - platform = dummyPlatform - } - - return &OSCommand{ - Common: common, - Platform: platform, - getenvFn: deps.GetenvFn, - removeFileFn: deps.RemoveFileFn, - guiIO: NewNullGuiIO(utils.NewDummyLog()), - Cmd: deps.Cmd, - } -} - -func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { - return &CmdObjBuilder{ - runner: runner, - platform: dummyPlatform, - } -} - -var dummyPlatform = &Platform{ - OS: "darwin", - Shell: "bash", - ShellArg: "-c", - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", -} - -func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand { - osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - osCommand.Cmd = NewDummyCmdObjBuilder(runner) - - return osCommand -} diff --git a/test/integration/staginWithDiffContextChange/files/one.txt b/test/integration/staginWithDiffContextChange/files/one.txt deleted file mode 100644 index 158e9a9c1..000000000 --- a/test/integration/staginWithDiffContextChange/files/one.txt +++ /dev/null @@ -1,63 +0,0 @@ -package oscommands - -import ( - "github.com/jesseduffield/lazygit/pkg/common" - "github.com/jesseduffield/lazygit/pkg/utils" -) - -// NewDummyOSCommand creates a new dummy OSCommand for testing -func NewDummyOSCommand() *OSCommand { - osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - - return osCmd -} - -type OSCommandDeps struct { - Common *common.Common - Platform *Platform - GetenvFn func(string) string - RemoveFileFn func(string) error - Cmd *CmdObjBuilder -} - -func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand { - common := deps.Common - if common == nil { - common = utils.NewDummyCommon() - } - - platform := deps.Platform - if platform == nil { - platform = dummyPlatform - } - - return &OSCommand{ - Common: common, - Platform: platform, - getenvFn: deps.GetenvFn, - removeFileFn: deps.RemoveFileFn, - guiIO: NewNullGuiIO(utils.NewDummyLog()), - } -} - -func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { - return &CmdObjBuilder{ - runner: runner, - platform: dummyPlatform, - } -} - -var dummyPlatform = &Platform{ - OS: "darwin", - Shell: "bash", - ShellArg: "-c", - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", -} - -func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand { - osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - osCommand.Cmd = NewDummyCmdObjBuilder(runner) - - return osCommand -} diff --git a/test/integration/staginWithDiffContextChange/files/one_new.txt b/test/integration/staginWithDiffContextChange/files/one_new.txt deleted file mode 100644 index c3323cfc9..000000000 --- a/test/integration/staginWithDiffContextChange/files/one_new.txt +++ /dev/null @@ -1,67 +0,0 @@ -package oscommands - -import ( - "github.com/jesseduffield/lazygit/pkg/common" - "github.com/jesseduffield/lazygit/pkg/utils" -) - -// NewDummyOSCommand creates a new dummy OSCommand for testing -func NewDummyOSCommand() *OSCommand { - osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - - return osCmd -} - -type OSCommandDeps struct { - Common *common.Common - Platform *Platform - GetenvFn func(string) string - RemoveFileFn func(string) error - Cmd *CmdObjBuilder -} - -func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand { - if deps.Cmd == nil { - panic("WHAT") - } - common := deps.Common - if common == nil { - common = utils.NewDummyCommon() - } - - platform := deps.Platform - if platform == nil { - platform = dummyPlatform - } - - return &OSCommand{ - Common: common, - Platform: platform, - getenvFn: deps.GetenvFn, - removeFileFn: deps.RemoveFileFn, - guiIO: NewNullGuiIO(utils.NewDummyLog()), - Cmd: deps.Cmd, - } -} - -func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { - return &CmdObjBuilder{ - runner: runner, - platform: dummyPlatform, - } -} - -var dummyPlatform = &Platform{ - OS: "darwin", - Shell: "bash", - ShellArg: "-c", - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", -} - -func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand { - osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - osCommand.Cmd = NewDummyCmdObjBuilder(runner) - - return osCommand -} diff --git a/test/integration/staginWithDiffContextChange/recording.json b/test/integration/staginWithDiffContextChange/recording.json deleted file mode 100644 index 5bce04f41..000000000 --- a/test/integration/staginWithDiffContextChange/recording.json +++ /dev/null @@ -1 +0,0 @@ -{"KeyEvents":[{"Timestamp":1395,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3036,"Mod":0,"Key":256,"Ch":125},{"Timestamp":3283,"Mod":0,"Key":256,"Ch":125},{"Timestamp":3483,"Mod":0,"Key":256,"Ch":125},{"Timestamp":3996,"Mod":0,"Key":256,"Ch":32},{"Timestamp":4629,"Mod":0,"Key":258,"Ch":0},{"Timestamp":5004,"Mod":0,"Key":258,"Ch":0},{"Timestamp":5067,"Mod":0,"Key":256,"Ch":118},{"Timestamp":5547,"Mod":0,"Key":257,"Ch":0},{"Timestamp":5867,"Mod":0,"Key":256,"Ch":118},{"Timestamp":6492,"Mod":0,"Key":256,"Ch":118},{"Timestamp":6628,"Mod":0,"Key":257,"Ch":0},{"Timestamp":6762,"Mod":0,"Key":257,"Ch":0},{"Timestamp":7779,"Mod":0,"Key":256,"Ch":125},{"Timestamp":8179,"Mod":0,"Key":256,"Ch":125},{"Timestamp":8723,"Mod":0,"Key":256,"Ch":32},{"Timestamp":9531,"Mod":0,"Key":259,"Ch":0},{"Timestamp":10170,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10379,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10500,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10833,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10849,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10865,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10881,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10898,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10915,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10931,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10947,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10964,"Mod":0,"Key":258,"Ch":0},{"Timestamp":11156,"Mod":0,"Key":258,"Ch":0},{"Timestamp":11308,"Mod":0,"Key":258,"Ch":0},{"Timestamp":11435,"Mod":0,"Key":256,"Ch":118},{"Timestamp":11571,"Mod":0,"Key":258,"Ch":0},{"Timestamp":11700,"Mod":0,"Key":258,"Ch":0},{"Timestamp":11828,"Mod":0,"Key":258,"Ch":0},{"Timestamp":11963,"Mod":0,"Key":258,"Ch":0},{"Timestamp":12083,"Mod":0,"Key":258,"Ch":0},{"Timestamp":12603,"Mod":0,"Key":256,"Ch":32},{"Timestamp":13051,"Mod":0,"Key":9,"Ch":9},{"Timestamp":14820,"Mod":0,"Key":256,"Ch":118},{"Timestamp":15028,"Mod":0,"Key":258,"Ch":0},{"Timestamp":15139,"Mod":0,"Key":258,"Ch":0},{"Timestamp":15266,"Mod":0,"Key":258,"Ch":0},{"Timestamp":15387,"Mod":0,"Key":258,"Ch":0},{"Timestamp":15500,"Mod":0,"Key":258,"Ch":0},{"Timestamp":16266,"Mod":0,"Key":256,"Ch":125},{"Timestamp":16483,"Mod":0,"Key":256,"Ch":125},{"Timestamp":16747,"Mod":0,"Key":256,"Ch":125},{"Timestamp":17412,"Mod":0,"Key":256,"Ch":32},{"Timestamp":19124,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file diff --git a/test/integration/staginWithDiffContextChange/setup.sh b/test/integration/staginWithDiffContextChange/setup.sh deleted file mode 100644 index 9b1f6fb8c..000000000 --- a/test/integration/staginWithDiffContextChange/setup.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -set -e - -cd $1 - -git init - -git config user.email "CI@example.com" -git config user.name "CI" - -cp ../../files/one.txt one.txt -git add . -git commit -am file1 - -cp ../../files/one_new.txt one.txt diff --git a/test/integration/staginWithDiffContextChange/test.json b/test/integration/staginWithDiffContextChange/test.json deleted file mode 100644 index 0351e0ec9..000000000 --- a/test/integration/staginWithDiffContextChange/test.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "description": "Staging a file and also changing the diff context", - "speed": 20 -} diff --git a/test/integration/staging/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration/staging/expected/repo/.git_keep/COMMIT_EDITMSG deleted file mode 100644 index 9daeafb98..000000000 --- a/test/integration/staging/expected/repo/.git_keep/COMMIT_EDITMSG +++ /dev/null @@ -1 +0,0 @@ -test diff --git a/test/integration/staging/expected/repo/.git_keep/FETCH_HEAD b/test/integration/staging/expected/repo/.git_keep/FETCH_HEAD deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/integration/staging/expected/repo/.git_keep/HEAD b/test/integration/staging/expected/repo/.git_keep/HEAD deleted file mode 100644 index cb089cd89..000000000 --- a/test/integration/staging/expected/repo/.git_keep/HEAD +++ /dev/null @@ -1 +0,0 @@ -ref: refs/heads/master diff --git a/test/integration/staging/expected/repo/.git_keep/config b/test/integration/staging/expected/repo/.git_keep/config deleted file mode 100644 index 8ae104545..000000000 --- a/test/integration/staging/expected/repo/.git_keep/config +++ /dev/null @@ -1,10 +0,0 @@ -[core] - repositoryformatversion = 0 - filemode = true - bare = false - logallrefupdates = true - ignorecase = true - precomposeunicode = true -[user] - email = CI@example.com - name = CI diff --git a/test/integration/staging/expected/repo/.git_keep/description b/test/integration/staging/expected/repo/.git_keep/description deleted file mode 100644 index 498b267a8..000000000 --- a/test/integration/staging/expected/repo/.git_keep/description +++ /dev/null @@ -1 +0,0 @@ -Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/staging/expected/repo/.git_keep/index b/test/integration/staging/expected/repo/.git_keep/index deleted file mode 100644 index 694ca5da2..000000000 Binary files a/test/integration/staging/expected/repo/.git_keep/index and /dev/null differ diff --git a/test/integration/staging/expected/repo/.git_keep/info/exclude b/test/integration/staging/expected/repo/.git_keep/info/exclude deleted file mode 100644 index 8e9f2071f..000000000 --- a/test/integration/staging/expected/repo/.git_keep/info/exclude +++ /dev/null @@ -1,7 +0,0 @@ -# git ls-files --others --exclude-from=.git/info/exclude -# Lines that start with '#' are comments. -# For a project mostly in C, the following would be a good set of -# exclude patterns (uncomment them if you want to use them): -# *.[oa] -# *~ -.DS_Store diff --git a/test/integration/staging/expected/repo/.git_keep/logs/HEAD b/test/integration/staging/expected/repo/.git_keep/logs/HEAD deleted file mode 100644 index fee95f75d..000000000 --- a/test/integration/staging/expected/repo/.git_keep/logs/HEAD +++ /dev/null @@ -1,2 +0,0 @@ -0000000000000000000000000000000000000000 6497d00f0447159947a805f3a38e8c44ed2865b1 CI 1659701362 +1000 commit (initial): file1 -6497d00f0447159947a805f3a38e8c44ed2865b1 a6985076907d3ed64cf59480bb2eec313ea221cf CI 1659701393 +1000 commit: test diff --git a/test/integration/staging/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/staging/expected/repo/.git_keep/logs/refs/heads/master deleted file mode 100644 index fee95f75d..000000000 --- a/test/integration/staging/expected/repo/.git_keep/logs/refs/heads/master +++ /dev/null @@ -1,2 +0,0 @@ -0000000000000000000000000000000000000000 6497d00f0447159947a805f3a38e8c44ed2865b1 CI 1659701362 +1000 commit (initial): file1 -6497d00f0447159947a805f3a38e8c44ed2865b1 a6985076907d3ed64cf59480bb2eec313ea221cf CI 1659701393 +1000 commit: test diff --git a/test/integration/staging/expected/repo/.git_keep/objects/12/c4186053ecd4056526743060a8fe87429b7306 b/test/integration/staging/expected/repo/.git_keep/objects/12/c4186053ecd4056526743060a8fe87429b7306 deleted file mode 100644 index 65f9a5559..000000000 Binary files a/test/integration/staging/expected/repo/.git_keep/objects/12/c4186053ecd4056526743060a8fe87429b7306 and /dev/null differ diff --git a/test/integration/staging/expected/repo/.git_keep/objects/63/5b45efaba0c2415658bc121de201ec43a47920 b/test/integration/staging/expected/repo/.git_keep/objects/63/5b45efaba0c2415658bc121de201ec43a47920 deleted file mode 100644 index 860950f65..000000000 --- a/test/integration/staging/expected/repo/.git_keep/objects/63/5b45efaba0c2415658bc121de201ec43a47920 +++ /dev/null @@ -1,4 +0,0 @@ -xMn0 ;)NtN:dYhK8Yt%y#M(#$=?t-ֶw pz_^ElEťgVC ^yMwI??Dy:Z&ފ'VU;&3;lIW:'i8 hфo!ji FZ?< \ No newline at end of file diff --git a/test/integration/staging/expected/repo/.git_keep/objects/d6/9b45d6d14e1864411d17930012210271c400c3 b/test/integration/staging/expected/repo/.git_keep/objects/d6/9b45d6d14e1864411d17930012210271c400c3 deleted file mode 100644 index b8ca4e19d..000000000 --- a/test/integration/staging/expected/repo/.git_keep/objects/d6/9b45d6d14e1864411d17930012210271c400c3 +++ /dev/null @@ -1,2 +0,0 @@ -x=;0Dhd 8hSbK$b0$.ҘjMA'#M#vo ?t=>ֶx pu;//"vC<ߵgVC ^x]I??F=}IJ!NmM;ϳ)aOZ-߽ Ѣ $-Vv \ No newline at end of file diff --git a/test/integration/staging/expected/repo/.git_keep/objects/e7/86ecad3cea3651947e6c2648f6dae87372276b b/test/integration/staging/expected/repo/.git_keep/objects/e7/86ecad3cea3651947e6c2648f6dae87372276b deleted file mode 100644 index b70a7418c..000000000 Binary files a/test/integration/staging/expected/repo/.git_keep/objects/e7/86ecad3cea3651947e6c2648f6dae87372276b and /dev/null differ diff --git a/test/integration/staging/expected/repo/.git_keep/objects/e8/aaa2f356eb341c693e239467fd200d0117b487 b/test/integration/staging/expected/repo/.git_keep/objects/e8/aaa2f356eb341c693e239467fd200d0117b487 deleted file mode 100644 index f444e5a1e..000000000 --- a/test/integration/staging/expected/repo/.git_keep/objects/e8/aaa2f356eb341c693e239467fd200d0117b487 +++ /dev/null @@ -1 +0,0 @@ -x==0 S/4ީ-*@vllі0gr0'ɓY )/.8I2Mpp_D;⇘F<= oaq6bV =1IV#:w+6#&8{/ _kv(WmJ]z)} ]dαk™Yx*81<ȩp ~TC;k>^%G g ffPˆKΰ%x1\hhgD Ljۈdϟ[`:H YkKWEKtQqmaCRn~?QnR kmtqνs+|"x_!fvؓVůe'ڟwA/Z4!oZZ- b \ No newline at end of file diff --git a/test/integration/staging/expected/repo/.git_keep/objects/eb/38d1e424df18868f73407ca8087b6350b59f3e b/test/integration/staging/expected/repo/.git_keep/objects/eb/38d1e424df18868f73407ca8087b6350b59f3e deleted file mode 100644 index 185fa81ec..000000000 Binary files a/test/integration/staging/expected/repo/.git_keep/objects/eb/38d1e424df18868f73407ca8087b6350b59f3e and /dev/null differ diff --git a/test/integration/staging/expected/repo/.git_keep/objects/fb/e09a11933b44ea60b46bd0f3d44142cb6189a4 b/test/integration/staging/expected/repo/.git_keep/objects/fb/e09a11933b44ea60b46bd0f3d44142cb6189a4 deleted file mode 100644 index 3d85419a6..000000000 Binary files a/test/integration/staging/expected/repo/.git_keep/objects/fb/e09a11933b44ea60b46bd0f3d44142cb6189a4 and /dev/null differ diff --git a/test/integration/staging/expected/repo/.git_keep/refs/heads/master b/test/integration/staging/expected/repo/.git_keep/refs/heads/master deleted file mode 100644 index a5323f973..000000000 --- a/test/integration/staging/expected/repo/.git_keep/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -a6985076907d3ed64cf59480bb2eec313ea221cf diff --git a/test/integration/staging/expected/repo/one.txt b/test/integration/staging/expected/repo/one.txt deleted file mode 100644 index 3a54c9212..000000000 --- a/test/integration/staging/expected/repo/one.txt +++ /dev/null @@ -1,15 +0,0 @@ -Out there, we've walked quite friendly up to Death, -- -Sat down and eaten with him, cool and bland, -- -Pardoned his spilling mess-tins in our hand. -We've sniffed the green thick smell of his breath, -- -Our eyes wept, but our courage did not writhe. -He's spat at us with bullets and he's coughed -Shrapnel. We sang when he sang aloft, -We whistled while he shaved us with his scythe. - -Oh, Death was never enemy of ours! -We laughed at him, we leagued with him, old chum. -No soldier's paid to kick against His powers. -We laughed, — knowing that greater men would come, -And greater wars: when each proud fighter brags -He wars on Death, for lives; not men, for flags diff --git a/test/integration/staging/expected/repo/three.txt b/test/integration/staging/expected/repo/three.txt deleted file mode 100644 index 500ce9c2b..000000000 --- a/test/integration/staging/expected/repo/three.txt +++ /dev/null @@ -1,298 +0,0 @@ -package gui - -import ( - "fmt" - "regexp" - "strings" - - "github.com/jesseduffield/lazygit/pkg/commands/git_commands" - "github.com/jesseduffield/lazygit/pkg/commands/loaders" - "github.com/jesseduffield/lazygit/pkg/commands/models" - "github.com/jesseduffield/lazygit/pkg/config" - "github.com/jesseduffield/lazygit/pkg/gui/nodetree" - "github.com/jesseduffield/lazygit/pkg/utils" -) - -// list panel functions - -func (gui *Gui) getSelectednodeNode() *nodetree.nodeNode { - selectedLine := gui.State.Panels.nodes.SelectedLineIdx - if selectedLine == -1 { - return nil - } - - return gui.State.nodeManager.GetItemAtIndex(selectedLine) -} - -func (gui *Gui) getSelectednode() *models.node { - node := gui.getSelectednodeNode() - if node == nil { - return nil - } - return node.node -} - -func (gui *Gui) getSelectedPath() string { - node := gui.getSelectednodeNode() - if node == nil { - return "" - } - - return node.GetPath() -} - -func (gui *Gui) nodesRenderToMain() error { - node := gui.getSelectednodeNode() - - if node == nil { - return gui.refreshMainViews(refreshMainOpts{ - main: &viewUpdateOpts{ - title: "", - task: NewRenderStringTask(gui.Tr.NoChangednodes), - }, - }) - } - - if node.node != nil && node.File.HasInlineMergeConflicts { - return gui.renderConflictsFromFilesPanel() - } - - cmdObj := gui.Git.WorkingTree.WorktreeFileDiffCmdObj(node, false, !node.GetHasUnstagedChanges() && node.GetHasStagedChanges(), gui.State.IgnoreWhitespaceInDiffView) - - refreshOpts := refreshMainOpts{main: &viewUpdateOpts{ - title: gui.Tr.UnstagedChanges, - task: NewRunPtyTask(cmdObj.GetCmd()), - }} - - if node.GetHasUnstagedChanges() { - if node.GetHasStagedChanges() { - cmdObj := gui.Git.WorkingTree.WorktreeFileDiffCmdObj(node, false, true, gui.State.IgnoreWhitespaceInDiffView) - - refreshOpts.secondary = &viewUpdateOpts{ - title: gui.Tr.StagedChanges, - task: NewRunPtyTask(cmdObj.GetCmd()), - } - } - } else { - refreshOpts.main.title = gui.Tr.StagedChanges - } - - return gui.refreshMainViews(refreshOpts) -} - -func (gui *Gui) refreshFilesAndSubmodules() error { - gui.Mutexes.RefreshingFilesMutex.Lock() - gui.State.IsRefreshingFiles = true - defer func() { - gui.State.IsRefreshingFiles = false - gui.Mutexes.RefreshingFilesMutex.Unlock() - }() - - selectedPath := gui.getSelectedPath() - - if err := gui.refreshStateSubmoduleConfigs(); err != nil { - return err - } - if err := gui.refreshStateFiles(); err != nil { - return err - } - - gui.OnUIThread(func() error { - if err := gui.postRefreshUpdate(gui.State.Contexts.Submodules); err != nil { - gui.Log.Error(err) - } - - if ContextKey(gui.Views.Files.Context) == FILES_CONTEXT_KEY { - // doing this a little custom (as opposed to using gui.postRefreshUpdate) because we handle selecting the file explicitly below - if err := gui.State.Contexts.Files.HandleRender(); err != nil { - return err - } - } - - if gui.currentContext().GetKey() == FILES_CONTEXT_KEY || (gui.g.CurrentView() == gui.Views.Main && ContextKey(gui.g.CurrentView().Context) == MAIN_MERGING_CONTEXT_KEY) { - newSelectedPath := gui.getSelectedPath() - alreadySelected := selectedPath != "" && newSelectedPath == selectedPath - if !alreadySelected { - gui.takeOverMergeConflictScrolling() - } - - gui.Views.Files.FocusPoint(0, gui.State.Panels.Files.SelectedLineIdx) - return gui.filesRenderToMain() - } - - return nil - }) - - return nil -} - -// specific functions - -func (gui *Gui) stagedFiles() []*models.File { - files := gui.State.FileManager.GetAllFiles() - result := make([]*models.File, 0) - for _, file := range files { - if file.HasStagedChanges { - result = append(result, file) - } - } - return result -} - -func (gui *Gui) trackedFiles() []*models.File { - files := gui.State.FileManager.GetAllFiles() - result := make([]*models.File, 0, len(files)) - for _, file := range files { - if file.Tracked { - result = append(result, file) - } - } - return result -} - -func (gui *Gui) stageSelectedFile() error { - file := gui.getSelectedFile() - if file == nil { - return nil - } - - return gui.Git.WorkingTree.StageFile(file.Name) -} - -func (gui *Gui) handleEnterFile() error { - return gui.enterFile(OnFocusOpts{ClickedViewName: "", ClickedViewLineIdx: -1}) -} - -func (gui *Gui) enterFile(opts OnFocusOpts) error { - node := gui.getSelectedFileNode() - if node == nil { - return nil - } - - if node.File == nil { - return gui.handleToggleDirCollapsed() - } - - file := node.File - - submoduleConfigs := gui.State.Submodules - if file.IsSubmodule(submoduleConfigs) { - submoduleConfig := file.SubmoduleConfig(submoduleConfigs) - return gui.enterSubmodule(submoduleConfig) - } - - if file.HasInlineMergeConflicts { - return gui.switchToMerge() - } - if file.HasMergeConflicts { - return gui.createErrorPanel(gui.Tr.FileStagingRequirements) - } - - return gui.pushContext(gui.State.Contexts.Staging, opts) -} - -func (gui *Gui) handleFilePress() error { - node := gui.getSelectedFileNode() - if node == nil { - return nil - } - - if node.IsLeaf() { - file := node.File - - if file.HasInlineMergeConflicts { - return gui.switchToMerge() - } - - if node.HasUnstagedChanges { - gui.logAction(gui.Tr.Actions.Stagenode) - if err := gui.Git.WorkingTree.Stagenode(node.Name); err != nil { - return gui.surfaceError(err) - } - } else { - gui.logAction(gui.Tr.Actions.Unstagenode) - if err := gui.Git.WorkingTree.UnStagenode(node.Names(), node.Tracked); err != nil { - return gui.surfaceError(err) - } - } - } else { - if node.GetHasInlineMergeConflicts() { - return gui.createErrorPanel(gui.Tr.ErrStageDirWithInlineMergeConflicts) - } - - if node.GetHasUnstagedChanges() { - gui.logAction(gui.Tr.Actions.Stagenode) - if err := gui.Git.WorkingTree.Stagenode(node.Path); err != nil { - return gui.surfaceError(err) - } - } else { - // pretty sure it doesn't matter that we're always passing true here - gui.logAction(gui.Tr.Actions.Unstagenode) - if err := gui.Git.WorkingTree.UnStagenode([]string{node.Path}, true); err != nil { - return gui.surfaceError(err) - } - } - } - - if err := gui.blah(refreshOptions{scope: []RefreshableView{nodeS}}); err != nil { - return err - } - - return gui.State.Contexts.nodes.HandleFocus() -} - -func (gui *Gui) allnodesStaged() bool { - for _, node := range gui.State.nodeManager.GetAllnodes() { - if node.HasUnstagedChanges { - return false - } - } - return true -} - -func (gui *Gui) onFocusnode() error { - gui.takeOverMergeConflictScrolling() - return nil -} - -func (gui *Gui) handleStageAll() error { - var err error - if gui.allnodesStaged() { - gui.logAction(gui.Tr.Actions.UnstageAllnodes) - err = gui.Git.WorkingTree.UnstageAll() - } else { - gui.logAction(gui.Tr.Actions.StageAllnodes) - err = gui.Git.WorkingTree.StageAll() - } - if err != nil { - _ = gui.surfaceError(err) - } - - if err := gui.blah(refreshOptions{scope: []RefreshableView{nodeS}}); err != nil { - return err - } - - return gui.State.Contexts.nodes.HandleFocus() -} - -func (gui *Gui) handleIgnorenode() error { - node := gui.getSelectednodeNode() - if node == nil { - return nil - } - - if node.GetPath() == ".gitignore" { - return gui.createErrorPanel("Cannot ignore .gitignore") - } - - unstagenodes := func() error { - return node.ForEachnode(func(node *models.node) error { - if node.HasStagedChanges { - if err := gui.Git.WorkingTree.UnStagenode(node.Names(), node.Tracked); err != nil { - return err - } - } - - return nil - }) - } diff --git a/test/integration/staging/expected/repo/two.txt b/test/integration/staging/expected/repo/two.txt deleted file mode 100644 index 73f226ec6..000000000 --- a/test/integration/staging/expected/repo/two.txt +++ /dev/null @@ -1,33 +0,0 @@ -type createMenuOptions struct { - showCancel bool -} - -func (gui *Gui) createMenu(title string, items []*menuItem, createMenuOptions createMenuOptions) error { - if createMenuOptions.showCancel { - // this is mutative but I'm okay with that for now - items = append(items, &menuItem{ - displayStrings: []string{gui.Tr.LcCancel}, - onPress: func() error { - return nil - }, - }) - } - - gui.State.MenuItems = items - - stringArrays := make([][]string, len(items)) - for i, item := range items { - if item.opensMenu && item.displayStrings != nil { - return errors.New("Message for the developer of this app: you've set opensMenu with displaystrings on the menu panel. Bad developer!. Apologies, user") - } - - if item.displayStrings == nil { - styledStr := item.displayString - if item.opensMenu { - styledStr = opensMenuStyle(styledStr) - } - stringArrays[0] = []str0ng{styledStr} - } else { - str0ngArrays[0] = item.displayStrings - } - } diff --git a/test/integration/staging/files/one.txt b/test/integration/staging/files/one.txt deleted file mode 100644 index e8aaa2f35..000000000 --- a/test/integration/staging/files/one.txt +++ /dev/null @@ -1,15 +0,0 @@ -Out there, we've walked quite friendly up to Death, -- -Sat down and eaten with him, cool and bland, -- -Pardoned his spilling mess-tins in our hand. -We've sniffed the green thick odour of his breath, -- -Our eyes wept, but our courage didn't writhe. -He's spat at us with bullets and he's coughed -Shrapnel. We chorused when he sang aloft, -We whistled while he shaved us with his scythe. - -Oh, Death was never enemy of ours! -We laughed at him, we leagued with him, old chum. -No soldier's paid to kick against His powers. -We laughed, — knowing that better men would come, -And greater wars: when each proud fighter brags -He wars on Death, for lives; not men, for flags diff --git a/test/integration/staging/files/one_new.txt b/test/integration/staging/files/one_new.txt deleted file mode 100644 index 3a54c9212..000000000 --- a/test/integration/staging/files/one_new.txt +++ /dev/null @@ -1,15 +0,0 @@ -Out there, we've walked quite friendly up to Death, -- -Sat down and eaten with him, cool and bland, -- -Pardoned his spilling mess-tins in our hand. -We've sniffed the green thick smell of his breath, -- -Our eyes wept, but our courage did not writhe. -He's spat at us with bullets and he's coughed -Shrapnel. We sang when he sang aloft, -We whistled while he shaved us with his scythe. - -Oh, Death was never enemy of ours! -We laughed at him, we leagued with him, old chum. -No soldier's paid to kick against His powers. -We laughed, — knowing that greater men would come, -And greater wars: when each proud fighter brags -He wars on Death, for lives; not men, for flags diff --git a/test/integration/staging/files/three.txt b/test/integration/staging/files/three.txt deleted file mode 100644 index a04255341..000000000 --- a/test/integration/staging/files/three.txt +++ /dev/null @@ -1,300 +0,0 @@ -package gui - -import ( - "fmt" - "regexp" - "strings" - - "github.com/jesseduffield/lazygit/pkg/commands/git_commands" - "github.com/jesseduffield/lazygit/pkg/commands/loaders" - "github.com/jesseduffield/lazygit/pkg/commands/models" - "github.com/jesseduffield/lazygit/pkg/config" - "github.com/jesseduffield/lazygit/pkg/gui/filetree" - "github.com/jesseduffield/lazygit/pkg/utils" -) - -// list panel functions - -func (gui *Gui) getSelectedFileNode() *filetree.FileNode { - selectedLine := gui.State.Panels.Files.SelectedLineIdx - if selectedLine == -1 { - return nil - } - - return gui.State.FileManager.GetItemAtIndex(selectedLine) -} - -func (gui *Gui) getSelectedFile() *models.File { - node := gui.getSelectedFileNode() - if node == nil { - return nil - } - return node.File -} - -func (gui *Gui) getSelectedPath() string { - node := gui.getSelectedFileNode() - if node == nil { - return "" - } - - return node.GetPath() -} - -func (gui *Gui) filesRenderToMain() error { - node := gui.getSelectedFileNode() - - if node == nil { - return gui.refreshMainViews(refreshMainOpts{ - main: &viewUpdateOpts{ - title: "", - task: NewRenderStringTask(gui.Tr.NoChangedFiles), - }, - }) - } - - if node.File != nil && node.File.HasInlineMergeConflicts { - return gui.renderConflictsFromFilesPanel() - } - - cmdObj := gui.Git.WorkingTree.WorktreeFileDiffCmdObj(node, false, !node.GetHasUnstagedChanges() && node.GetHasStagedChanges(), gui.State.IgnoreWhitespaceInDiffView) - - refreshOpts := refreshMainOpts{main: &viewUpdateOpts{ - title: gui.Tr.UnstagedChanges, - task: NewRunPtyTask(cmdObj.GetCmd()), - }} - - if node.GetHasUnstagedChanges() { - if node.GetHasStagedChanges() { - cmdObj := gui.Git.WorkingTree.WorktreeFileDiffCmdObj(node, false, true, gui.State.IgnoreWhitespaceInDiffView) - - refreshOpts.secondary = &viewUpdateOpts{ - title: gui.Tr.StagedChanges, - task: NewRunPtyTask(cmdObj.GetCmd()), - } - } - } else { - refreshOpts.main.title = gui.Tr.StagedChanges - } - - return gui.refreshMainViews(refreshOpts) -} - -func (gui *Gui) refreshFilesAndSubmodules() error { - gui.Mutexes.RefreshingFilesMutex.Lock() - gui.State.IsRefreshingFiles = true - defer func() { - gui.State.IsRefreshingFiles = false - gui.Mutexes.RefreshingFilesMutex.Unlock() - }() - - selectedPath := gui.getSelectedPath() - - if err := gui.refreshStateSubmoduleConfigs(); err != nil { - return err - } - if err := gui.refreshStateFiles(); err != nil { - return err - } - - gui.OnUIThread(func() error { - if err := gui.postRefreshUpdate(gui.State.Contexts.Submodules); err != nil { - gui.Log.Error(err) - } - - if ContextKey(gui.Views.Files.Context) == FILES_CONTEXT_KEY { - // doing this a little custom (as opposed to using gui.postRefreshUpdate) because we handle selecting the file explicitly below - if err := gui.State.Contexts.Files.HandleRender(); err != nil { - return err - } - } - - if gui.currentContext().GetKey() == FILES_CONTEXT_KEY || (gui.g.CurrentView() == gui.Views.Main && ContextKey(gui.g.CurrentView().Context) == MAIN_MERGING_CONTEXT_KEY) { - newSelectedPath := gui.getSelectedPath() - alreadySelected := selectedPath != "" && newSelectedPath == selectedPath - if !alreadySelected { - gui.takeOverMergeConflictScrolling() - } - - gui.Views.Files.FocusPoint(0, gui.State.Panels.Files.SelectedLineIdx) - return gui.filesRenderToMain() - } - - return nil - }) - - return nil -} - -// specific functions - -func (gui *Gui) stagedFiles() []*models.File { - files := gui.State.FileManager.GetAllFiles() - result := make([]*models.File, 0) - for _, file := range files { - if file.HasStagedChanges { - result = append(result, file) - } - } - return result -} - -func (gui *Gui) trackedFiles() []*models.File { - files := gui.State.FileManager.GetAllFiles() - result := make([]*models.File, 0, len(files)) - for _, file := range files { - if file.Tracked { - result = append(result, file) - } - } - return result -} - -func (gui *Gui) stageSelectedFile() error { - file := gui.getSelectedFile() - if file == nil { - return nil - } - - return gui.Git.WorkingTree.StageFile(file.Name) -} - -func (gui *Gui) handleEnterFile() error { - return gui.enterFile(OnFocusOpts{ClickedViewName: "", ClickedViewLineIdx: -1}) -} - -func (gui *Gui) enterFile(opts OnFocusOpts) error { - node := gui.getSelectedFileNode() - if node == nil { - return nil - } - - if node.File == nil { - return gui.handleToggleDirCollapsed() - } - - file := node.File - - submoduleConfigs := gui.State.Submodules - if file.IsSubmodule(submoduleConfigs) { - submoduleConfig := file.SubmoduleConfig(submoduleConfigs) - return gui.enterSubmodule(submoduleConfig) - } - - if file.HasInlineMergeConflicts { - return gui.switchToMerge() - } - if file.HasMergeConflicts { - return gui.createErrorPanel(gui.Tr.FileStagingRequirements) - } - - return gui.pushContext(gui.State.Contexts.Staging, opts) -} - -func (gui *Gui) handleFilePress() error { - node := gui.getSelectedFileNode() - if node == nil { - return nil - } - - if node.IsLeaf() { - file := node.File - - if file.HasInlineMergeConflicts { - return gui.switchToMerge() - } - - if file.HasUnstagedChanges { - gui.logAction(gui.Tr.Actions.StageFile) - if err := gui.Git.WorkingTree.StageFile(file.Name); err != nil { - return gui.surfaceError(err) - } - } else { - gui.logAction(gui.Tr.Actions.UnstageFile) - if err := gui.Git.WorkingTree.UnStageFile(file.Names(), file.Tracked); err != nil { - return gui.surfaceError(err) - } - } - } else { - // if any files within have inline merge conflicts we can't stage or unstage, - // or it'll end up with those >>>>>> lines actually staged - if node.GetHasInlineMergeConflicts() { - return gui.createErrorPanel(gui.Tr.ErrStageDirWithInlineMergeConflicts) - } - - if node.GetHasUnstagedChanges() { - gui.logAction(gui.Tr.Actions.StageFile) - if err := gui.Git.WorkingTree.StageFile(node.Path); err != nil { - return gui.surfaceError(err) - } - } else { - // pretty sure it doesn't matter that we're always passing true here - gui.logAction(gui.Tr.Actions.UnstageFile) - if err := gui.Git.WorkingTree.UnStageFile([]string{node.Path}, true); err != nil { - return gui.surfaceError(err) - } - } - } - - if err := gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{FILES}}); err != nil { - return err - } - - return gui.State.Contexts.Files.HandleFocus() -} - -func (gui *Gui) allFilesStaged() bool { - for _, file := range gui.State.FileManager.GetAllFiles() { - if file.HasUnstagedChanges { - return false - } - } - return true -} - -func (gui *Gui) onFocusFile() error { - gui.takeOverMergeConflictScrolling() - return nil -} - -func (gui *Gui) handleStageAll() error { - var err error - if gui.allFilesStaged() { - gui.logAction(gui.Tr.Actions.UnstageAllFiles) - err = gui.Git.WorkingTree.UnstageAll() - } else { - gui.logAction(gui.Tr.Actions.StageAllFiles) - err = gui.Git.WorkingTree.StageAll() - } - if err != nil { - _ = gui.surfaceError(err) - } - - if err := gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{FILES}}); err != nil { - return err - } - - return gui.State.Contexts.Files.HandleFocus() -} - -func (gui *Gui) handleIgnoreFile() error { - node := gui.getSelectedFileNode() - if node == nil { - return nil - } - - if node.GetPath() == ".gitignore" { - return gui.createErrorPanel("Cannot ignore .gitignore") - } - - unstageFiles := func() error { - return node.ForEachFile(func(file *models.File) error { - if file.HasStagedChanges { - if err := gui.Git.WorkingTree.UnStageFile(file.Names(), file.Tracked); err != nil { - return err - } - } - - return nil - }) - } diff --git a/test/integration/staging/files/three_new.txt b/test/integration/staging/files/three_new.txt deleted file mode 100644 index 500ce9c2b..000000000 --- a/test/integration/staging/files/three_new.txt +++ /dev/null @@ -1,298 +0,0 @@ -package gui - -import ( - "fmt" - "regexp" - "strings" - - "github.com/jesseduffield/lazygit/pkg/commands/git_commands" - "github.com/jesseduffield/lazygit/pkg/commands/loaders" - "github.com/jesseduffield/lazygit/pkg/commands/models" - "github.com/jesseduffield/lazygit/pkg/config" - "github.com/jesseduffield/lazygit/pkg/gui/nodetree" - "github.com/jesseduffield/lazygit/pkg/utils" -) - -// list panel functions - -func (gui *Gui) getSelectednodeNode() *nodetree.nodeNode { - selectedLine := gui.State.Panels.nodes.SelectedLineIdx - if selectedLine == -1 { - return nil - } - - return gui.State.nodeManager.GetItemAtIndex(selectedLine) -} - -func (gui *Gui) getSelectednode() *models.node { - node := gui.getSelectednodeNode() - if node == nil { - return nil - } - return node.node -} - -func (gui *Gui) getSelectedPath() string { - node := gui.getSelectednodeNode() - if node == nil { - return "" - } - - return node.GetPath() -} - -func (gui *Gui) nodesRenderToMain() error { - node := gui.getSelectednodeNode() - - if node == nil { - return gui.refreshMainViews(refreshMainOpts{ - main: &viewUpdateOpts{ - title: "", - task: NewRenderStringTask(gui.Tr.NoChangednodes), - }, - }) - } - - if node.node != nil && node.File.HasInlineMergeConflicts { - return gui.renderConflictsFromFilesPanel() - } - - cmdObj := gui.Git.WorkingTree.WorktreeFileDiffCmdObj(node, false, !node.GetHasUnstagedChanges() && node.GetHasStagedChanges(), gui.State.IgnoreWhitespaceInDiffView) - - refreshOpts := refreshMainOpts{main: &viewUpdateOpts{ - title: gui.Tr.UnstagedChanges, - task: NewRunPtyTask(cmdObj.GetCmd()), - }} - - if node.GetHasUnstagedChanges() { - if node.GetHasStagedChanges() { - cmdObj := gui.Git.WorkingTree.WorktreeFileDiffCmdObj(node, false, true, gui.State.IgnoreWhitespaceInDiffView) - - refreshOpts.secondary = &viewUpdateOpts{ - title: gui.Tr.StagedChanges, - task: NewRunPtyTask(cmdObj.GetCmd()), - } - } - } else { - refreshOpts.main.title = gui.Tr.StagedChanges - } - - return gui.refreshMainViews(refreshOpts) -} - -func (gui *Gui) refreshFilesAndSubmodules() error { - gui.Mutexes.RefreshingFilesMutex.Lock() - gui.State.IsRefreshingFiles = true - defer func() { - gui.State.IsRefreshingFiles = false - gui.Mutexes.RefreshingFilesMutex.Unlock() - }() - - selectedPath := gui.getSelectedPath() - - if err := gui.refreshStateSubmoduleConfigs(); err != nil { - return err - } - if err := gui.refreshStateFiles(); err != nil { - return err - } - - gui.OnUIThread(func() error { - if err := gui.postRefreshUpdate(gui.State.Contexts.Submodules); err != nil { - gui.Log.Error(err) - } - - if ContextKey(gui.Views.Files.Context) == FILES_CONTEXT_KEY { - // doing this a little custom (as opposed to using gui.postRefreshUpdate) because we handle selecting the file explicitly below - if err := gui.State.Contexts.Files.HandleRender(); err != nil { - return err - } - } - - if gui.currentContext().GetKey() == FILES_CONTEXT_KEY || (gui.g.CurrentView() == gui.Views.Main && ContextKey(gui.g.CurrentView().Context) == MAIN_MERGING_CONTEXT_KEY) { - newSelectedPath := gui.getSelectedPath() - alreadySelected := selectedPath != "" && newSelectedPath == selectedPath - if !alreadySelected { - gui.takeOverMergeConflictScrolling() - } - - gui.Views.Files.FocusPoint(0, gui.State.Panels.Files.SelectedLineIdx) - return gui.filesRenderToMain() - } - - return nil - }) - - return nil -} - -// specific functions - -func (gui *Gui) stagedFiles() []*models.File { - files := gui.State.FileManager.GetAllFiles() - result := make([]*models.File, 0) - for _, file := range files { - if file.HasStagedChanges { - result = append(result, file) - } - } - return result -} - -func (gui *Gui) trackedFiles() []*models.File { - files := gui.State.FileManager.GetAllFiles() - result := make([]*models.File, 0, len(files)) - for _, file := range files { - if file.Tracked { - result = append(result, file) - } - } - return result -} - -func (gui *Gui) stageSelectedFile() error { - file := gui.getSelectedFile() - if file == nil { - return nil - } - - return gui.Git.WorkingTree.StageFile(file.Name) -} - -func (gui *Gui) handleEnterFile() error { - return gui.enterFile(OnFocusOpts{ClickedViewName: "", ClickedViewLineIdx: -1}) -} - -func (gui *Gui) enterFile(opts OnFocusOpts) error { - node := gui.getSelectedFileNode() - if node == nil { - return nil - } - - if node.File == nil { - return gui.handleToggleDirCollapsed() - } - - file := node.File - - submoduleConfigs := gui.State.Submodules - if file.IsSubmodule(submoduleConfigs) { - submoduleConfig := file.SubmoduleConfig(submoduleConfigs) - return gui.enterSubmodule(submoduleConfig) - } - - if file.HasInlineMergeConflicts { - return gui.switchToMerge() - } - if file.HasMergeConflicts { - return gui.createErrorPanel(gui.Tr.FileStagingRequirements) - } - - return gui.pushContext(gui.State.Contexts.Staging, opts) -} - -func (gui *Gui) handleFilePress() error { - node := gui.getSelectedFileNode() - if node == nil { - return nil - } - - if node.IsLeaf() { - file := node.File - - if file.HasInlineMergeConflicts { - return gui.switchToMerge() - } - - if node.HasUnstagedChanges { - gui.logAction(gui.Tr.Actions.Stagenode) - if err := gui.Git.WorkingTree.Stagenode(node.Name); err != nil { - return gui.surfaceError(err) - } - } else { - gui.logAction(gui.Tr.Actions.Unstagenode) - if err := gui.Git.WorkingTree.UnStagenode(node.Names(), node.Tracked); err != nil { - return gui.surfaceError(err) - } - } - } else { - if node.GetHasInlineMergeConflicts() { - return gui.createErrorPanel(gui.Tr.ErrStageDirWithInlineMergeConflicts) - } - - if node.GetHasUnstagedChanges() { - gui.logAction(gui.Tr.Actions.Stagenode) - if err := gui.Git.WorkingTree.Stagenode(node.Path); err != nil { - return gui.surfaceError(err) - } - } else { - // pretty sure it doesn't matter that we're always passing true here - gui.logAction(gui.Tr.Actions.Unstagenode) - if err := gui.Git.WorkingTree.UnStagenode([]string{node.Path}, true); err != nil { - return gui.surfaceError(err) - } - } - } - - if err := gui.blah(refreshOptions{scope: []RefreshableView{nodeS}}); err != nil { - return err - } - - return gui.State.Contexts.nodes.HandleFocus() -} - -func (gui *Gui) allnodesStaged() bool { - for _, node := range gui.State.nodeManager.GetAllnodes() { - if node.HasUnstagedChanges { - return false - } - } - return true -} - -func (gui *Gui) onFocusnode() error { - gui.takeOverMergeConflictScrolling() - return nil -} - -func (gui *Gui) handleStageAll() error { - var err error - if gui.allnodesStaged() { - gui.logAction(gui.Tr.Actions.UnstageAllnodes) - err = gui.Git.WorkingTree.UnstageAll() - } else { - gui.logAction(gui.Tr.Actions.StageAllnodes) - err = gui.Git.WorkingTree.StageAll() - } - if err != nil { - _ = gui.surfaceError(err) - } - - if err := gui.blah(refreshOptions{scope: []RefreshableView{nodeS}}); err != nil { - return err - } - - return gui.State.Contexts.nodes.HandleFocus() -} - -func (gui *Gui) handleIgnorenode() error { - node := gui.getSelectednodeNode() - if node == nil { - return nil - } - - if node.GetPath() == ".gitignore" { - return gui.createErrorPanel("Cannot ignore .gitignore") - } - - unstagenodes := func() error { - return node.ForEachnode(func(node *models.node) error { - if node.HasStagedChanges { - if err := gui.Git.WorkingTree.UnStagenode(node.Names(), node.Tracked); err != nil { - return err - } - } - - return nil - }) - } diff --git a/test/integration/staging/files/two.txt b/test/integration/staging/files/two.txt deleted file mode 100644 index a48a7caa7..000000000 --- a/test/integration/staging/files/two.txt +++ /dev/null @@ -1,33 +0,0 @@ -type createMenuOptions struct { - showCancel bool -} - -func (gui *Gui) createMenu(title string, items []*menuItem, createMenuOptions createMenuOptions) error { - if createMenuOptions.showCancel { - // this is mutative but I'm okay with that for now - items = append(items, &menuItem{ - displayStrings: []string{gui.Tr.LcCancel}, - onPress: func() error { - return nil - }, - }) - } - - gui.State.MenuItems = items - - stringArrays := make([][]string, len(items)) - for i, item := range items { - if item.opensMenu && item.displayStrings != nil { - return errors.New("Message for the developer of this app: you've set opensMenu with displaystrings on the menu panel. Bad developer!. Apologies, user") - } - - if item.displayStrings == nil { - styledStr := item.displayString - if item.opensMenu { - styledStr = opensMenuStyle(styledStr) - } - stringArrays[i] = []string{styledStr} - } else { - stringArrays[i] = item.displayStrings - } - } diff --git a/test/integration/staging/files/two_new.txt b/test/integration/staging/files/two_new.txt deleted file mode 100644 index bbe2a2f2c..000000000 --- a/test/integration/staging/files/two_new.txt +++ /dev/null @@ -1,33 +0,0 @@ -type createMenuOptions struct { - showCancel bool -} - -func (gui *Gui) createMenu(title string, items []*menuItem, createMenuOptions createMenuOptions) error { - if createMenuOptions.showCancel { - // this is mutative but I'm okay with that for now - items = app(items, &menuItem{ - d: []string{gui.Tr.LcCancel}, - onPress: func() error { - return nil - }, - }) - } - - gui.State.MenuItems = items - - stringArrays := make([][]string, len(items)) - for i, items := range items { - if items.opensMenu && item.displayStrings != nil { - return errors.New("Message for the developer of this app: you've set opensMenu with displaystrings on the menu panel. Bad developer!. Apologies, user") - } - - if item.displayStrings == nil { - styledStr := item.displayString - if item.opensMenu { - styledStr = opensMenuStyle(styledStr) - } - stringArrays[0] = []str0ng{styledStr} - } else { - str0ngArrays[0] = item.displayStrings - } - } diff --git a/test/integration/staging/recording.json b/test/integration/staging/recording.json deleted file mode 100644 index 73d7e58d1..000000000 --- a/test/integration/staging/recording.json +++ /dev/null @@ -1 +0,0 @@ -{"KeyEvents":[{"Timestamp":699,"Mod":0,"Key":13,"Ch":13},{"Timestamp":1521,"Mod":0,"Key":256,"Ch":32},{"Timestamp":1825,"Mod":0,"Key":256,"Ch":32},{"Timestamp":2154,"Mod":0,"Key":256,"Ch":118},{"Timestamp":2338,"Mod":0,"Key":258,"Ch":0},{"Timestamp":2560,"Mod":0,"Key":256,"Ch":32},{"Timestamp":3210,"Mod":0,"Key":9,"Ch":9},{"Timestamp":3610,"Mod":0,"Key":256,"Ch":118},{"Timestamp":3762,"Mod":0,"Key":258,"Ch":0},{"Timestamp":3907,"Mod":0,"Key":258,"Ch":0},{"Timestamp":4034,"Mod":0,"Key":258,"Ch":0},{"Timestamp":4328,"Mod":0,"Key":256,"Ch":32},{"Timestamp":5857,"Mod":0,"Key":258,"Ch":0},{"Timestamp":6019,"Mod":0,"Key":258,"Ch":0},{"Timestamp":6170,"Mod":0,"Key":258,"Ch":0},{"Timestamp":6314,"Mod":0,"Key":258,"Ch":0},{"Timestamp":6474,"Mod":0,"Key":258,"Ch":0},{"Timestamp":6626,"Mod":0,"Key":258,"Ch":0},{"Timestamp":6778,"Mod":0,"Key":258,"Ch":0},{"Timestamp":6930,"Mod":0,"Key":258,"Ch":0},{"Timestamp":7074,"Mod":0,"Key":258,"Ch":0},{"Timestamp":7218,"Mod":0,"Key":258,"Ch":0},{"Timestamp":7368,"Mod":0,"Key":258,"Ch":0},{"Timestamp":8064,"Mod":0,"Key":256,"Ch":32},{"Timestamp":8586,"Mod":0,"Key":258,"Ch":0},{"Timestamp":8930,"Mod":0,"Key":256,"Ch":118},{"Timestamp":9130,"Mod":0,"Key":258,"Ch":0},{"Timestamp":9354,"Mod":0,"Key":256,"Ch":32},{"Timestamp":10488,"Mod":0,"Key":27,"Ch":0},{"Timestamp":11354,"Mod":0,"Key":258,"Ch":0},{"Timestamp":11650,"Mod":0,"Key":13,"Ch":13},{"Timestamp":12194,"Mod":0,"Key":256,"Ch":97},{"Timestamp":12841,"Mod":0,"Key":256,"Ch":32},{"Timestamp":14144,"Mod":0,"Key":9,"Ch":9},{"Timestamp":14698,"Mod":0,"Key":256,"Ch":97},{"Timestamp":15082,"Mod":0,"Key":256,"Ch":32},{"Timestamp":15993,"Mod":0,"Key":256,"Ch":97},{"Timestamp":16330,"Mod":0,"Key":256,"Ch":32},{"Timestamp":16850,"Mod":0,"Key":256,"Ch":32},{"Timestamp":17594,"Mod":0,"Key":256,"Ch":32},{"Timestamp":18405,"Mod":0,"Key":27,"Ch":0},{"Timestamp":18858,"Mod":0,"Key":258,"Ch":0},{"Timestamp":20379,"Mod":0,"Key":13,"Ch":13},{"Timestamp":23458,"Mod":0,"Key":256,"Ch":118},{"Timestamp":23675,"Mod":0,"Key":258,"Ch":0},{"Timestamp":23824,"Mod":0,"Key":258,"Ch":0},{"Timestamp":23968,"Mod":0,"Key":258,"Ch":0},{"Timestamp":24338,"Mod":0,"Key":256,"Ch":100},{"Timestamp":24747,"Mod":0,"Key":13,"Ch":13},{"Timestamp":25281,"Mod":0,"Key":256,"Ch":97},{"Timestamp":25651,"Mod":0,"Key":256,"Ch":100},{"Timestamp":26050,"Mod":0,"Key":13,"Ch":13},{"Timestamp":27056,"Mod":0,"Key":256,"Ch":32},{"Timestamp":27849,"Mod":0,"Key":27,"Ch":0},{"Timestamp":28746,"Mod":0,"Key":256,"Ch":99},{"Timestamp":29019,"Mod":0,"Key":256,"Ch":116},{"Timestamp":29074,"Mod":0,"Key":256,"Ch":101},{"Timestamp":29273,"Mod":0,"Key":256,"Ch":115},{"Timestamp":29297,"Mod":0,"Key":256,"Ch":116},{"Timestamp":29538,"Mod":0,"Key":13,"Ch":13},{"Timestamp":30098,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":118,"Height":61}]} \ No newline at end of file diff --git a/test/integration/staging/setup.sh b/test/integration/staging/setup.sh deleted file mode 100644 index da73083d2..000000000 --- a/test/integration/staging/setup.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -cd $1 - -git init - -git config user.email "CI@example.com" -git config user.name "CI" - -cp ../../files/one.txt one.txt -cp ../../files/two.txt two.txt -cp ../../files/three.txt three.txt -git add . -git commit -am file1 - -cp ../../files/one_new.txt one.txt -cp ../../files/two_new.txt two.txt -cp ../../files/three_new.txt three.txt diff --git a/test/integration/staging/test.json b/test/integration/staging/test.json deleted file mode 100644 index f93f82f13..000000000 --- a/test/integration/staging/test.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "description": "Staging a file via the patch explorer", - "speed": 30 -} diff --git a/test/integration/stagingDiscard/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration/stagingDiscard/expected/repo/.git_keep/COMMIT_EDITMSG deleted file mode 100644 index e2129701f..000000000 --- a/test/integration/stagingDiscard/expected/repo/.git_keep/COMMIT_EDITMSG +++ /dev/null @@ -1 +0,0 @@ -file1 diff --git a/test/integration/stagingDiscard/expected/repo/.git_keep/FETCH_HEAD b/test/integration/stagingDiscard/expected/repo/.git_keep/FETCH_HEAD deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/integration/stagingDiscard/expected/repo/.git_keep/HEAD b/test/integration/stagingDiscard/expected/repo/.git_keep/HEAD deleted file mode 100644 index cb089cd89..000000000 --- a/test/integration/stagingDiscard/expected/repo/.git_keep/HEAD +++ /dev/null @@ -1 +0,0 @@ -ref: refs/heads/master diff --git a/test/integration/stagingDiscard/expected/repo/.git_keep/config b/test/integration/stagingDiscard/expected/repo/.git_keep/config deleted file mode 100644 index 8ae104545..000000000 --- a/test/integration/stagingDiscard/expected/repo/.git_keep/config +++ /dev/null @@ -1,10 +0,0 @@ -[core] - repositoryformatversion = 0 - filemode = true - bare = false - logallrefupdates = true - ignorecase = true - precomposeunicode = true -[user] - email = CI@example.com - name = CI diff --git a/test/integration/stagingDiscard/expected/repo/.git_keep/description b/test/integration/stagingDiscard/expected/repo/.git_keep/description deleted file mode 100644 index 498b267a8..000000000 --- a/test/integration/stagingDiscard/expected/repo/.git_keep/description +++ /dev/null @@ -1 +0,0 @@ -Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/stagingDiscard/expected/repo/.git_keep/index b/test/integration/stagingDiscard/expected/repo/.git_keep/index deleted file mode 100644 index b80cdaea2..000000000 Binary files a/test/integration/stagingDiscard/expected/repo/.git_keep/index and /dev/null differ diff --git a/test/integration/stagingDiscard/expected/repo/.git_keep/info/exclude b/test/integration/stagingDiscard/expected/repo/.git_keep/info/exclude deleted file mode 100644 index 8e9f2071f..000000000 --- a/test/integration/stagingDiscard/expected/repo/.git_keep/info/exclude +++ /dev/null @@ -1,7 +0,0 @@ -# git ls-files --others --exclude-from=.git/info/exclude -# Lines that start with '#' are comments. -# For a project mostly in C, the following would be a good set of -# exclude patterns (uncomment them if you want to use them): -# *.[oa] -# *~ -.DS_Store diff --git a/test/integration/stagingDiscard/expected/repo/.git_keep/logs/HEAD b/test/integration/stagingDiscard/expected/repo/.git_keep/logs/HEAD deleted file mode 100644 index 2f8312a35..000000000 --- a/test/integration/stagingDiscard/expected/repo/.git_keep/logs/HEAD +++ /dev/null @@ -1 +0,0 @@ -0000000000000000000000000000000000000000 adf0c68f5e5508ce3fc598d5f01a53486bd9d287 CI 1659736149 +1000 commit (initial): file1 diff --git a/test/integration/stagingDiscard/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/stagingDiscard/expected/repo/.git_keep/logs/refs/heads/master deleted file mode 100644 index 2f8312a35..000000000 --- a/test/integration/stagingDiscard/expected/repo/.git_keep/logs/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -0000000000000000000000000000000000000000 adf0c68f5e5508ce3fc598d5f01a53486bd9d287 CI 1659736149 +1000 commit (initial): file1 diff --git a/test/integration/stagingDiscard/expected/repo/.git_keep/objects/15/8e9a9c1a9627ea0ef4de8b00a503ed0f80a09e b/test/integration/stagingDiscard/expected/repo/.git_keep/objects/15/8e9a9c1a9627ea0ef4de8b00a503ed0f80a09e deleted file mode 100644 index 2c00719b0..000000000 Binary files a/test/integration/stagingDiscard/expected/repo/.git_keep/objects/15/8e9a9c1a9627ea0ef4de8b00a503ed0f80a09e and /dev/null differ diff --git a/test/integration/stagingDiscard/expected/repo/.git_keep/objects/7b/9c2149f16c706cea79b03234cb67fde7e9b68f b/test/integration/stagingDiscard/expected/repo/.git_keep/objects/7b/9c2149f16c706cea79b03234cb67fde7e9b68f deleted file mode 100644 index 611ed37a4..000000000 Binary files a/test/integration/stagingDiscard/expected/repo/.git_keep/objects/7b/9c2149f16c706cea79b03234cb67fde7e9b68f and /dev/null differ diff --git a/test/integration/stagingDiscard/expected/repo/.git_keep/objects/ad/f0c68f5e5508ce3fc598d5f01a53486bd9d287 b/test/integration/stagingDiscard/expected/repo/.git_keep/objects/ad/f0c68f5e5508ce3fc598d5f01a53486bd9d287 deleted file mode 100644 index e09a17564..000000000 Binary files a/test/integration/stagingDiscard/expected/repo/.git_keep/objects/ad/f0c68f5e5508ce3fc598d5f01a53486bd9d287 and /dev/null differ diff --git a/test/integration/stagingDiscard/expected/repo/.git_keep/refs/heads/master b/test/integration/stagingDiscard/expected/repo/.git_keep/refs/heads/master deleted file mode 100644 index ddab060df..000000000 --- a/test/integration/stagingDiscard/expected/repo/.git_keep/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -adf0c68f5e5508ce3fc598d5f01a53486bd9d287 diff --git a/test/integration/stagingDiscard/expected/repo/one.txt b/test/integration/stagingDiscard/expected/repo/one.txt deleted file mode 100644 index 9b92aa365..000000000 --- a/test/integration/stagingDiscard/expected/repo/one.txt +++ /dev/null @@ -1,64 +0,0 @@ -package oscommands - -import ( - "github.com/jesseduffield/lazygit/pkg/common" - "github.com/jesseduffield/lazygit/pkg/utils" -) - -// NewDummyOSCommand creates a new dummy OSCommand for testing -func NewDummyOSCommand() *OSCommand { - osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - - return osCmd -} - -type OSCommandDeps struct { - Common *common.Common - Platform *Platform - GetenvFn func(string) string - RemoveFileFn func(string) error - Cmd *CmdObjBuilder -} - -func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand { - common := deps.Common - if common == nil { - common = utils.NewDummyCommon() - } - - platform := deps.Platform - if platform == nil { - platform = dummyPlatform - } - - return &OSCommand{ - Common: common, - Platform: platform, - getenvFn: deps.GetenvFn, - removeFileFn: deps.RemoveFileFn, - guiIO: NewNullGuiIO(utils.NewDummyLog()), - Cmd: deps.Cmd, - } -} - -func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { - return &CmdObjBuilder{ - runner: runner, - platform: dummyPlatform, - } -} - -var dummyPlatform = &Platform{ - OS: "darwin", - Shell: "bash", - ShellArg: "-c", - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", -} - -func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand { - osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - osCommand.Cmd = NewDummyCmdObjBuilder(runner) - - return osCommand -} diff --git a/test/integration/stagingDiscard/files/one.txt b/test/integration/stagingDiscard/files/one.txt deleted file mode 100644 index 158e9a9c1..000000000 --- a/test/integration/stagingDiscard/files/one.txt +++ /dev/null @@ -1,63 +0,0 @@ -package oscommands - -import ( - "github.com/jesseduffield/lazygit/pkg/common" - "github.com/jesseduffield/lazygit/pkg/utils" -) - -// NewDummyOSCommand creates a new dummy OSCommand for testing -func NewDummyOSCommand() *OSCommand { - osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - - return osCmd -} - -type OSCommandDeps struct { - Common *common.Common - Platform *Platform - GetenvFn func(string) string - RemoveFileFn func(string) error - Cmd *CmdObjBuilder -} - -func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand { - common := deps.Common - if common == nil { - common = utils.NewDummyCommon() - } - - platform := deps.Platform - if platform == nil { - platform = dummyPlatform - } - - return &OSCommand{ - Common: common, - Platform: platform, - getenvFn: deps.GetenvFn, - removeFileFn: deps.RemoveFileFn, - guiIO: NewNullGuiIO(utils.NewDummyLog()), - } -} - -func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { - return &CmdObjBuilder{ - runner: runner, - platform: dummyPlatform, - } -} - -var dummyPlatform = &Platform{ - OS: "darwin", - Shell: "bash", - ShellArg: "-c", - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", -} - -func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand { - osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - osCommand.Cmd = NewDummyCmdObjBuilder(runner) - - return osCommand -} diff --git a/test/integration/stagingDiscard/files/one_new.txt b/test/integration/stagingDiscard/files/one_new.txt deleted file mode 100644 index c3323cfc9..000000000 --- a/test/integration/stagingDiscard/files/one_new.txt +++ /dev/null @@ -1,67 +0,0 @@ -package oscommands - -import ( - "github.com/jesseduffield/lazygit/pkg/common" - "github.com/jesseduffield/lazygit/pkg/utils" -) - -// NewDummyOSCommand creates a new dummy OSCommand for testing -func NewDummyOSCommand() *OSCommand { - osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - - return osCmd -} - -type OSCommandDeps struct { - Common *common.Common - Platform *Platform - GetenvFn func(string) string - RemoveFileFn func(string) error - Cmd *CmdObjBuilder -} - -func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand { - if deps.Cmd == nil { - panic("WHAT") - } - common := deps.Common - if common == nil { - common = utils.NewDummyCommon() - } - - platform := deps.Platform - if platform == nil { - platform = dummyPlatform - } - - return &OSCommand{ - Common: common, - Platform: platform, - getenvFn: deps.GetenvFn, - removeFileFn: deps.RemoveFileFn, - guiIO: NewNullGuiIO(utils.NewDummyLog()), - Cmd: deps.Cmd, - } -} - -func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { - return &CmdObjBuilder{ - runner: runner, - platform: dummyPlatform, - } -} - -var dummyPlatform = &Platform{ - OS: "darwin", - Shell: "bash", - ShellArg: "-c", - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", -} - -func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand { - osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - osCommand.Cmd = NewDummyCmdObjBuilder(runner) - - return osCommand -} diff --git a/test/integration/stagingDiscard/recording.json b/test/integration/stagingDiscard/recording.json deleted file mode 100644 index b123b242c..000000000 --- a/test/integration/stagingDiscard/recording.json +++ /dev/null @@ -1 +0,0 @@ -{"KeyEvents":[{"Timestamp":771,"Mod":0,"Key":13,"Ch":13},{"Timestamp":1187,"Mod":0,"Key":256,"Ch":118},{"Timestamp":1428,"Mod":0,"Key":258,"Ch":0},{"Timestamp":1604,"Mod":0,"Key":258,"Ch":0},{"Timestamp":1901,"Mod":0,"Key":256,"Ch":100},{"Timestamp":2213,"Mod":0,"Key":13,"Ch":13},{"Timestamp":2947,"Mod":0,"Key":27,"Ch":0},{"Timestamp":3555,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":118,"Height":61}]} \ No newline at end of file diff --git a/test/integration/stagingDiscard/setup.sh b/test/integration/stagingDiscard/setup.sh deleted file mode 100644 index 9b1f6fb8c..000000000 --- a/test/integration/stagingDiscard/setup.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -set -e - -cd $1 - -git init - -git config user.email "CI@example.com" -git config user.name "CI" - -cp ../../files/one.txt one.txt -git add . -git commit -am file1 - -cp ../../files/one_new.txt one.txt diff --git a/test/integration/stagingDiscard/test.json b/test/integration/stagingDiscard/test.json deleted file mode 100644 index 63bb457ce..000000000 --- a/test/integration/stagingDiscard/test.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "description": "Discard a chunk of code", - "speed": 20 -} diff --git a/test/integration/stagingDiscardAll/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration/stagingDiscardAll/expected/repo/.git_keep/COMMIT_EDITMSG deleted file mode 100644 index e2129701f..000000000 --- a/test/integration/stagingDiscardAll/expected/repo/.git_keep/COMMIT_EDITMSG +++ /dev/null @@ -1 +0,0 @@ -file1 diff --git a/test/integration/stagingDiscardAll/expected/repo/.git_keep/FETCH_HEAD b/test/integration/stagingDiscardAll/expected/repo/.git_keep/FETCH_HEAD deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/integration/stagingDiscardAll/expected/repo/.git_keep/HEAD b/test/integration/stagingDiscardAll/expected/repo/.git_keep/HEAD deleted file mode 100644 index cb089cd89..000000000 --- a/test/integration/stagingDiscardAll/expected/repo/.git_keep/HEAD +++ /dev/null @@ -1 +0,0 @@ -ref: refs/heads/master diff --git a/test/integration/stagingDiscardAll/expected/repo/.git_keep/config b/test/integration/stagingDiscardAll/expected/repo/.git_keep/config deleted file mode 100644 index 8ae104545..000000000 --- a/test/integration/stagingDiscardAll/expected/repo/.git_keep/config +++ /dev/null @@ -1,10 +0,0 @@ -[core] - repositoryformatversion = 0 - filemode = true - bare = false - logallrefupdates = true - ignorecase = true - precomposeunicode = true -[user] - email = CI@example.com - name = CI diff --git a/test/integration/stagingDiscardAll/expected/repo/.git_keep/description b/test/integration/stagingDiscardAll/expected/repo/.git_keep/description deleted file mode 100644 index 498b267a8..000000000 --- a/test/integration/stagingDiscardAll/expected/repo/.git_keep/description +++ /dev/null @@ -1 +0,0 @@ -Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/stagingDiscardAll/expected/repo/.git_keep/index b/test/integration/stagingDiscardAll/expected/repo/.git_keep/index deleted file mode 100644 index a0c00de83..000000000 Binary files a/test/integration/stagingDiscardAll/expected/repo/.git_keep/index and /dev/null differ diff --git a/test/integration/stagingDiscardAll/expected/repo/.git_keep/info/exclude b/test/integration/stagingDiscardAll/expected/repo/.git_keep/info/exclude deleted file mode 100644 index 8e9f2071f..000000000 --- a/test/integration/stagingDiscardAll/expected/repo/.git_keep/info/exclude +++ /dev/null @@ -1,7 +0,0 @@ -# git ls-files --others --exclude-from=.git/info/exclude -# Lines that start with '#' are comments. -# For a project mostly in C, the following would be a good set of -# exclude patterns (uncomment them if you want to use them): -# *.[oa] -# *~ -.DS_Store diff --git a/test/integration/stagingDiscardAll/expected/repo/.git_keep/logs/HEAD b/test/integration/stagingDiscardAll/expected/repo/.git_keep/logs/HEAD deleted file mode 100644 index 55d603f68..000000000 --- a/test/integration/stagingDiscardAll/expected/repo/.git_keep/logs/HEAD +++ /dev/null @@ -1 +0,0 @@ -0000000000000000000000000000000000000000 bccb06809b2f0e67bb3d3dd22c2b95882e72cbbb CI 1659736351 +1000 commit (initial): file1 diff --git a/test/integration/stagingDiscardAll/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/stagingDiscardAll/expected/repo/.git_keep/logs/refs/heads/master deleted file mode 100644 index 55d603f68..000000000 --- a/test/integration/stagingDiscardAll/expected/repo/.git_keep/logs/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -0000000000000000000000000000000000000000 bccb06809b2f0e67bb3d3dd22c2b95882e72cbbb CI 1659736351 +1000 commit (initial): file1 diff --git a/test/integration/stagingDiscardAll/expected/repo/.git_keep/objects/15/8e9a9c1a9627ea0ef4de8b00a503ed0f80a09e b/test/integration/stagingDiscardAll/expected/repo/.git_keep/objects/15/8e9a9c1a9627ea0ef4de8b00a503ed0f80a09e deleted file mode 100644 index 2c00719b0..000000000 Binary files a/test/integration/stagingDiscardAll/expected/repo/.git_keep/objects/15/8e9a9c1a9627ea0ef4de8b00a503ed0f80a09e and /dev/null differ diff --git a/test/integration/stagingDiscardAll/expected/repo/.git_keep/objects/39/a5edebb09b8ebc0269f35c60e2e963b71de9d1 b/test/integration/stagingDiscardAll/expected/repo/.git_keep/objects/39/a5edebb09b8ebc0269f35c60e2e963b71de9d1 deleted file mode 100644 index f506978c5..000000000 Binary files a/test/integration/stagingDiscardAll/expected/repo/.git_keep/objects/39/a5edebb09b8ebc0269f35c60e2e963b71de9d1 and /dev/null differ diff --git a/test/integration/stagingDiscardAll/expected/repo/.git_keep/objects/bb/e897baa83fd0099ba30daf3a97edc97d8c86b5 b/test/integration/stagingDiscardAll/expected/repo/.git_keep/objects/bb/e897baa83fd0099ba30daf3a97edc97d8c86b5 deleted file mode 100644 index b878ef1b2..000000000 Binary files a/test/integration/stagingDiscardAll/expected/repo/.git_keep/objects/bb/e897baa83fd0099ba30daf3a97edc97d8c86b5 and /dev/null differ diff --git a/test/integration/stagingDiscardAll/expected/repo/.git_keep/objects/bc/cb06809b2f0e67bb3d3dd22c2b95882e72cbbb b/test/integration/stagingDiscardAll/expected/repo/.git_keep/objects/bc/cb06809b2f0e67bb3d3dd22c2b95882e72cbbb deleted file mode 100644 index 24ceec3ca..000000000 --- a/test/integration/stagingDiscardAll/expected/repo/.git_keep/objects/bc/cb06809b2f0e67bb3d3dd22c2b95882e72cbbb +++ /dev/null @@ -1,4 +0,0 @@ -xM -0sʌ1E -`H -ۗTKYI#k|"&.%A24 M33}#2x ݅UIß,1?,O \ No newline at end of file diff --git a/test/integration/stagingDiscardAll/expected/repo/.git_keep/refs/heads/master b/test/integration/stagingDiscardAll/expected/repo/.git_keep/refs/heads/master deleted file mode 100644 index 044f5dd99..000000000 --- a/test/integration/stagingDiscardAll/expected/repo/.git_keep/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -bccb06809b2f0e67bb3d3dd22c2b95882e72cbbb diff --git a/test/integration/stagingDiscardAll/expected/repo/one.txt b/test/integration/stagingDiscardAll/expected/repo/one.txt deleted file mode 100644 index 158e9a9c1..000000000 --- a/test/integration/stagingDiscardAll/expected/repo/one.txt +++ /dev/null @@ -1,63 +0,0 @@ -package oscommands - -import ( - "github.com/jesseduffield/lazygit/pkg/common" - "github.com/jesseduffield/lazygit/pkg/utils" -) - -// NewDummyOSCommand creates a new dummy OSCommand for testing -func NewDummyOSCommand() *OSCommand { - osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - - return osCmd -} - -type OSCommandDeps struct { - Common *common.Common - Platform *Platform - GetenvFn func(string) string - RemoveFileFn func(string) error - Cmd *CmdObjBuilder -} - -func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand { - common := deps.Common - if common == nil { - common = utils.NewDummyCommon() - } - - platform := deps.Platform - if platform == nil { - platform = dummyPlatform - } - - return &OSCommand{ - Common: common, - Platform: platform, - getenvFn: deps.GetenvFn, - removeFileFn: deps.RemoveFileFn, - guiIO: NewNullGuiIO(utils.NewDummyLog()), - } -} - -func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { - return &CmdObjBuilder{ - runner: runner, - platform: dummyPlatform, - } -} - -var dummyPlatform = &Platform{ - OS: "darwin", - Shell: "bash", - ShellArg: "-c", - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", -} - -func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand { - osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - osCommand.Cmd = NewDummyCmdObjBuilder(runner) - - return osCommand -} diff --git a/test/integration/stagingDiscardAll/expected/repo/two.txt b/test/integration/stagingDiscardAll/expected/repo/two.txt deleted file mode 100644 index c3323cfc9..000000000 --- a/test/integration/stagingDiscardAll/expected/repo/two.txt +++ /dev/null @@ -1,67 +0,0 @@ -package oscommands - -import ( - "github.com/jesseduffield/lazygit/pkg/common" - "github.com/jesseduffield/lazygit/pkg/utils" -) - -// NewDummyOSCommand creates a new dummy OSCommand for testing -func NewDummyOSCommand() *OSCommand { - osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - - return osCmd -} - -type OSCommandDeps struct { - Common *common.Common - Platform *Platform - GetenvFn func(string) string - RemoveFileFn func(string) error - Cmd *CmdObjBuilder -} - -func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand { - if deps.Cmd == nil { - panic("WHAT") - } - common := deps.Common - if common == nil { - common = utils.NewDummyCommon() - } - - platform := deps.Platform - if platform == nil { - platform = dummyPlatform - } - - return &OSCommand{ - Common: common, - Platform: platform, - getenvFn: deps.GetenvFn, - removeFileFn: deps.RemoveFileFn, - guiIO: NewNullGuiIO(utils.NewDummyLog()), - Cmd: deps.Cmd, - } -} - -func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { - return &CmdObjBuilder{ - runner: runner, - platform: dummyPlatform, - } -} - -var dummyPlatform = &Platform{ - OS: "darwin", - Shell: "bash", - ShellArg: "-c", - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", -} - -func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand { - osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - osCommand.Cmd = NewDummyCmdObjBuilder(runner) - - return osCommand -} diff --git a/test/integration/stagingDiscardAll/files/one.txt b/test/integration/stagingDiscardAll/files/one.txt deleted file mode 100644 index 158e9a9c1..000000000 --- a/test/integration/stagingDiscardAll/files/one.txt +++ /dev/null @@ -1,63 +0,0 @@ -package oscommands - -import ( - "github.com/jesseduffield/lazygit/pkg/common" - "github.com/jesseduffield/lazygit/pkg/utils" -) - -// NewDummyOSCommand creates a new dummy OSCommand for testing -func NewDummyOSCommand() *OSCommand { - osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - - return osCmd -} - -type OSCommandDeps struct { - Common *common.Common - Platform *Platform - GetenvFn func(string) string - RemoveFileFn func(string) error - Cmd *CmdObjBuilder -} - -func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand { - common := deps.Common - if common == nil { - common = utils.NewDummyCommon() - } - - platform := deps.Platform - if platform == nil { - platform = dummyPlatform - } - - return &OSCommand{ - Common: common, - Platform: platform, - getenvFn: deps.GetenvFn, - removeFileFn: deps.RemoveFileFn, - guiIO: NewNullGuiIO(utils.NewDummyLog()), - } -} - -func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { - return &CmdObjBuilder{ - runner: runner, - platform: dummyPlatform, - } -} - -var dummyPlatform = &Platform{ - OS: "darwin", - Shell: "bash", - ShellArg: "-c", - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", -} - -func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand { - osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - osCommand.Cmd = NewDummyCmdObjBuilder(runner) - - return osCommand -} diff --git a/test/integration/stagingDiscardAll/files/one_new.txt b/test/integration/stagingDiscardAll/files/one_new.txt deleted file mode 100644 index c3323cfc9..000000000 --- a/test/integration/stagingDiscardAll/files/one_new.txt +++ /dev/null @@ -1,67 +0,0 @@ -package oscommands - -import ( - "github.com/jesseduffield/lazygit/pkg/common" - "github.com/jesseduffield/lazygit/pkg/utils" -) - -// NewDummyOSCommand creates a new dummy OSCommand for testing -func NewDummyOSCommand() *OSCommand { - osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - - return osCmd -} - -type OSCommandDeps struct { - Common *common.Common - Platform *Platform - GetenvFn func(string) string - RemoveFileFn func(string) error - Cmd *CmdObjBuilder -} - -func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand { - if deps.Cmd == nil { - panic("WHAT") - } - common := deps.Common - if common == nil { - common = utils.NewDummyCommon() - } - - platform := deps.Platform - if platform == nil { - platform = dummyPlatform - } - - return &OSCommand{ - Common: common, - Platform: platform, - getenvFn: deps.GetenvFn, - removeFileFn: deps.RemoveFileFn, - guiIO: NewNullGuiIO(utils.NewDummyLog()), - Cmd: deps.Cmd, - } -} - -func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { - return &CmdObjBuilder{ - runner: runner, - platform: dummyPlatform, - } -} - -var dummyPlatform = &Platform{ - OS: "darwin", - Shell: "bash", - ShellArg: "-c", - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", -} - -func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand { - osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - osCommand.Cmd = NewDummyCmdObjBuilder(runner) - - return osCommand -} diff --git a/test/integration/stagingDiscardAll/recording.json b/test/integration/stagingDiscardAll/recording.json deleted file mode 100644 index 037222739..000000000 --- a/test/integration/stagingDiscardAll/recording.json +++ /dev/null @@ -1 +0,0 @@ -{"KeyEvents":[{"Timestamp":472,"Mod":0,"Key":13,"Ch":13},{"Timestamp":720,"Mod":0,"Key":256,"Ch":97},{"Timestamp":944,"Mod":0,"Key":256,"Ch":100},{"Timestamp":1192,"Mod":0,"Key":13,"Ch":13},{"Timestamp":1494,"Mod":0,"Key":256,"Ch":100},{"Timestamp":1782,"Mod":0,"Key":13,"Ch":13},{"Timestamp":2368,"Mod":0,"Key":256,"Ch":32},{"Timestamp":3038,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":118,"Height":61}]} \ No newline at end of file diff --git a/test/integration/stagingDiscardAll/setup.sh b/test/integration/stagingDiscardAll/setup.sh deleted file mode 100644 index 31adabafe..000000000 --- a/test/integration/stagingDiscardAll/setup.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -set -e - -cd $1 - -git init - -git config user.email "CI@example.com" -git config user.name "CI" - -cp ../../files/one.txt one.txt -cp ../../files/one.txt two.txt -git add . -git commit -am file1 - -cp ../../files/one_new.txt one.txt -cp ../../files/one_new.txt two.txt diff --git a/test/integration/stagingDiscardAll/test.json b/test/integration/stagingDiscardAll/test.json deleted file mode 100644 index 3b35675f6..000000000 --- a/test/integration/stagingDiscardAll/test.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "description": "Discard all changes in a file via staging panel and expect to end up in the staging panel for the next file.", - "speed": 20 -} diff --git a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration/stagingEnterSecondary/expected/repo/.git_keep/COMMIT_EDITMSG deleted file mode 100644 index e2129701f..000000000 --- a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/COMMIT_EDITMSG +++ /dev/null @@ -1 +0,0 @@ -file1 diff --git a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/FETCH_HEAD b/test/integration/stagingEnterSecondary/expected/repo/.git_keep/FETCH_HEAD deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/HEAD b/test/integration/stagingEnterSecondary/expected/repo/.git_keep/HEAD deleted file mode 100644 index cb089cd89..000000000 --- a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/HEAD +++ /dev/null @@ -1 +0,0 @@ -ref: refs/heads/master diff --git a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/config b/test/integration/stagingEnterSecondary/expected/repo/.git_keep/config deleted file mode 100644 index 8ae104545..000000000 --- a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/config +++ /dev/null @@ -1,10 +0,0 @@ -[core] - repositoryformatversion = 0 - filemode = true - bare = false - logallrefupdates = true - ignorecase = true - precomposeunicode = true -[user] - email = CI@example.com - name = CI diff --git a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/description b/test/integration/stagingEnterSecondary/expected/repo/.git_keep/description deleted file mode 100644 index 498b267a8..000000000 --- a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/description +++ /dev/null @@ -1 +0,0 @@ -Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/index b/test/integration/stagingEnterSecondary/expected/repo/.git_keep/index deleted file mode 100644 index f3a2f5731..000000000 Binary files a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/index and /dev/null differ diff --git a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/info/exclude b/test/integration/stagingEnterSecondary/expected/repo/.git_keep/info/exclude deleted file mode 100644 index 8e9f2071f..000000000 --- a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/info/exclude +++ /dev/null @@ -1,7 +0,0 @@ -# git ls-files --others --exclude-from=.git/info/exclude -# Lines that start with '#' are comments. -# For a project mostly in C, the following would be a good set of -# exclude patterns (uncomment them if you want to use them): -# *.[oa] -# *~ -.DS_Store diff --git a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/logs/HEAD b/test/integration/stagingEnterSecondary/expected/repo/.git_keep/logs/HEAD deleted file mode 100644 index 82a2a1a3f..000000000 --- a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/logs/HEAD +++ /dev/null @@ -1 +0,0 @@ -0000000000000000000000000000000000000000 68a4bb206023fd2396e04e1ccdf9b853cda4ac70 CI 1659736184 +1000 commit (initial): file1 diff --git a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/stagingEnterSecondary/expected/repo/.git_keep/logs/refs/heads/master deleted file mode 100644 index 82a2a1a3f..000000000 --- a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/logs/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -0000000000000000000000000000000000000000 68a4bb206023fd2396e04e1ccdf9b853cda4ac70 CI 1659736184 +1000 commit (initial): file1 diff --git a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/objects/15/8e9a9c1a9627ea0ef4de8b00a503ed0f80a09e b/test/integration/stagingEnterSecondary/expected/repo/.git_keep/objects/15/8e9a9c1a9627ea0ef4de8b00a503ed0f80a09e deleted file mode 100644 index 2c00719b0..000000000 Binary files a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/objects/15/8e9a9c1a9627ea0ef4de8b00a503ed0f80a09e and /dev/null differ diff --git a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/objects/68/a4bb206023fd2396e04e1ccdf9b853cda4ac70 b/test/integration/stagingEnterSecondary/expected/repo/.git_keep/objects/68/a4bb206023fd2396e04e1ccdf9b853cda4ac70 deleted file mode 100644 index 75a0d2a51..000000000 Binary files a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/objects/68/a4bb206023fd2396e04e1ccdf9b853cda4ac70 and /dev/null differ diff --git a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/objects/7b/9c2149f16c706cea79b03234cb67fde7e9b68f b/test/integration/stagingEnterSecondary/expected/repo/.git_keep/objects/7b/9c2149f16c706cea79b03234cb67fde7e9b68f deleted file mode 100644 index 611ed37a4..000000000 Binary files a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/objects/7b/9c2149f16c706cea79b03234cb67fde7e9b68f and /dev/null differ diff --git a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/objects/ad/92dc7671a5129b87f0f5c70c90b488ae0ceea6 b/test/integration/stagingEnterSecondary/expected/repo/.git_keep/objects/ad/92dc7671a5129b87f0f5c70c90b488ae0ceea6 deleted file mode 100644 index 191ffe162..000000000 Binary files a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/objects/ad/92dc7671a5129b87f0f5c70c90b488ae0ceea6 and /dev/null differ diff --git a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/objects/c3/323cfc94775013acea4145545f47ac1af5c9d2 b/test/integration/stagingEnterSecondary/expected/repo/.git_keep/objects/c3/323cfc94775013acea4145545f47ac1af5c9d2 deleted file mode 100644 index 530b393a0..000000000 Binary files a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/objects/c3/323cfc94775013acea4145545f47ac1af5c9d2 and /dev/null differ diff --git a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/refs/heads/master b/test/integration/stagingEnterSecondary/expected/repo/.git_keep/refs/heads/master deleted file mode 100644 index 995be4311..000000000 --- a/test/integration/stagingEnterSecondary/expected/repo/.git_keep/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -68a4bb206023fd2396e04e1ccdf9b853cda4ac70 diff --git a/test/integration/stagingEnterSecondary/expected/repo/one.txt b/test/integration/stagingEnterSecondary/expected/repo/one.txt deleted file mode 100644 index c3323cfc9..000000000 --- a/test/integration/stagingEnterSecondary/expected/repo/one.txt +++ /dev/null @@ -1,67 +0,0 @@ -package oscommands - -import ( - "github.com/jesseduffield/lazygit/pkg/common" - "github.com/jesseduffield/lazygit/pkg/utils" -) - -// NewDummyOSCommand creates a new dummy OSCommand for testing -func NewDummyOSCommand() *OSCommand { - osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - - return osCmd -} - -type OSCommandDeps struct { - Common *common.Common - Platform *Platform - GetenvFn func(string) string - RemoveFileFn func(string) error - Cmd *CmdObjBuilder -} - -func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand { - if deps.Cmd == nil { - panic("WHAT") - } - common := deps.Common - if common == nil { - common = utils.NewDummyCommon() - } - - platform := deps.Platform - if platform == nil { - platform = dummyPlatform - } - - return &OSCommand{ - Common: common, - Platform: platform, - getenvFn: deps.GetenvFn, - removeFileFn: deps.RemoveFileFn, - guiIO: NewNullGuiIO(utils.NewDummyLog()), - Cmd: deps.Cmd, - } -} - -func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { - return &CmdObjBuilder{ - runner: runner, - platform: dummyPlatform, - } -} - -var dummyPlatform = &Platform{ - OS: "darwin", - Shell: "bash", - ShellArg: "-c", - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", -} - -func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand { - osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - osCommand.Cmd = NewDummyCmdObjBuilder(runner) - - return osCommand -} diff --git a/test/integration/stagingEnterSecondary/files/one.txt b/test/integration/stagingEnterSecondary/files/one.txt deleted file mode 100644 index 158e9a9c1..000000000 --- a/test/integration/stagingEnterSecondary/files/one.txt +++ /dev/null @@ -1,63 +0,0 @@ -package oscommands - -import ( - "github.com/jesseduffield/lazygit/pkg/common" - "github.com/jesseduffield/lazygit/pkg/utils" -) - -// NewDummyOSCommand creates a new dummy OSCommand for testing -func NewDummyOSCommand() *OSCommand { - osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - - return osCmd -} - -type OSCommandDeps struct { - Common *common.Common - Platform *Platform - GetenvFn func(string) string - RemoveFileFn func(string) error - Cmd *CmdObjBuilder -} - -func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand { - common := deps.Common - if common == nil { - common = utils.NewDummyCommon() - } - - platform := deps.Platform - if platform == nil { - platform = dummyPlatform - } - - return &OSCommand{ - Common: common, - Platform: platform, - getenvFn: deps.GetenvFn, - removeFileFn: deps.RemoveFileFn, - guiIO: NewNullGuiIO(utils.NewDummyLog()), - } -} - -func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { - return &CmdObjBuilder{ - runner: runner, - platform: dummyPlatform, - } -} - -var dummyPlatform = &Platform{ - OS: "darwin", - Shell: "bash", - ShellArg: "-c", - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", -} - -func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand { - osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - osCommand.Cmd = NewDummyCmdObjBuilder(runner) - - return osCommand -} diff --git a/test/integration/stagingEnterSecondary/files/one_new.txt b/test/integration/stagingEnterSecondary/files/one_new.txt deleted file mode 100644 index c3323cfc9..000000000 --- a/test/integration/stagingEnterSecondary/files/one_new.txt +++ /dev/null @@ -1,67 +0,0 @@ -package oscommands - -import ( - "github.com/jesseduffield/lazygit/pkg/common" - "github.com/jesseduffield/lazygit/pkg/utils" -) - -// NewDummyOSCommand creates a new dummy OSCommand for testing -func NewDummyOSCommand() *OSCommand { - osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - - return osCmd -} - -type OSCommandDeps struct { - Common *common.Common - Platform *Platform - GetenvFn func(string) string - RemoveFileFn func(string) error - Cmd *CmdObjBuilder -} - -func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand { - if deps.Cmd == nil { - panic("WHAT") - } - common := deps.Common - if common == nil { - common = utils.NewDummyCommon() - } - - platform := deps.Platform - if platform == nil { - platform = dummyPlatform - } - - return &OSCommand{ - Common: common, - Platform: platform, - getenvFn: deps.GetenvFn, - removeFileFn: deps.RemoveFileFn, - guiIO: NewNullGuiIO(utils.NewDummyLog()), - Cmd: deps.Cmd, - } -} - -func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { - return &CmdObjBuilder{ - runner: runner, - platform: dummyPlatform, - } -} - -var dummyPlatform = &Platform{ - OS: "darwin", - Shell: "bash", - ShellArg: "-c", - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", -} - -func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand { - osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - osCommand.Cmd = NewDummyCmdObjBuilder(runner) - - return osCommand -} diff --git a/test/integration/stagingEnterSecondary/recording.json b/test/integration/stagingEnterSecondary/recording.json deleted file mode 100644 index 8bac345be..000000000 --- a/test/integration/stagingEnterSecondary/recording.json +++ /dev/null @@ -1 +0,0 @@ -{"KeyEvents":[{"Timestamp":704,"Mod":0,"Key":256,"Ch":32},{"Timestamp":1719,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3183,"Mod":0,"Key":256,"Ch":118},{"Timestamp":3504,"Mod":0,"Key":258,"Ch":0},{"Timestamp":3976,"Mod":0,"Key":256,"Ch":32},{"Timestamp":4944,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":118,"Height":61}]} \ No newline at end of file diff --git a/test/integration/stagingEnterSecondary/setup.sh b/test/integration/stagingEnterSecondary/setup.sh deleted file mode 100644 index 9b1f6fb8c..000000000 --- a/test/integration/stagingEnterSecondary/setup.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -set -e - -cd $1 - -git init - -git config user.email "CI@example.com" -git config user.name "CI" - -cp ../../files/one.txt one.txt -git add . -git commit -am file1 - -cp ../../files/one_new.txt one.txt diff --git a/test/integration/stagingEnterSecondary/test.json b/test/integration/stagingEnterSecondary/test.json deleted file mode 100644 index 03bdc4b46..000000000 --- a/test/integration/stagingEnterSecondary/test.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "description": "Hit enter on a fully staged file to end up in the secondary staging panel.", - "speed": 20 -} diff --git a/test/integration/stagingForcedToggle/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration/stagingForcedToggle/expected/repo/.git_keep/COMMIT_EDITMSG deleted file mode 100644 index e2129701f..000000000 --- a/test/integration/stagingForcedToggle/expected/repo/.git_keep/COMMIT_EDITMSG +++ /dev/null @@ -1 +0,0 @@ -file1 diff --git a/test/integration/stagingForcedToggle/expected/repo/.git_keep/FETCH_HEAD b/test/integration/stagingForcedToggle/expected/repo/.git_keep/FETCH_HEAD deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/integration/stagingForcedToggle/expected/repo/.git_keep/HEAD b/test/integration/stagingForcedToggle/expected/repo/.git_keep/HEAD deleted file mode 100644 index cb089cd89..000000000 --- a/test/integration/stagingForcedToggle/expected/repo/.git_keep/HEAD +++ /dev/null @@ -1 +0,0 @@ -ref: refs/heads/master diff --git a/test/integration/stagingForcedToggle/expected/repo/.git_keep/config b/test/integration/stagingForcedToggle/expected/repo/.git_keep/config deleted file mode 100644 index 8ae104545..000000000 --- a/test/integration/stagingForcedToggle/expected/repo/.git_keep/config +++ /dev/null @@ -1,10 +0,0 @@ -[core] - repositoryformatversion = 0 - filemode = true - bare = false - logallrefupdates = true - ignorecase = true - precomposeunicode = true -[user] - email = CI@example.com - name = CI diff --git a/test/integration/stagingForcedToggle/expected/repo/.git_keep/description b/test/integration/stagingForcedToggle/expected/repo/.git_keep/description deleted file mode 100644 index 498b267a8..000000000 --- a/test/integration/stagingForcedToggle/expected/repo/.git_keep/description +++ /dev/null @@ -1 +0,0 @@ -Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/stagingForcedToggle/expected/repo/.git_keep/index b/test/integration/stagingForcedToggle/expected/repo/.git_keep/index deleted file mode 100644 index 5f7e35196..000000000 Binary files a/test/integration/stagingForcedToggle/expected/repo/.git_keep/index and /dev/null differ diff --git a/test/integration/stagingForcedToggle/expected/repo/.git_keep/info/exclude b/test/integration/stagingForcedToggle/expected/repo/.git_keep/info/exclude deleted file mode 100644 index 8e9f2071f..000000000 --- a/test/integration/stagingForcedToggle/expected/repo/.git_keep/info/exclude +++ /dev/null @@ -1,7 +0,0 @@ -# git ls-files --others --exclude-from=.git/info/exclude -# Lines that start with '#' are comments. -# For a project mostly in C, the following would be a good set of -# exclude patterns (uncomment them if you want to use them): -# *.[oa] -# *~ -.DS_Store diff --git a/test/integration/stagingForcedToggle/expected/repo/.git_keep/logs/HEAD b/test/integration/stagingForcedToggle/expected/repo/.git_keep/logs/HEAD deleted file mode 100644 index e60ea548f..000000000 --- a/test/integration/stagingForcedToggle/expected/repo/.git_keep/logs/HEAD +++ /dev/null @@ -1 +0,0 @@ -0000000000000000000000000000000000000000 de59eafcc9bdb8fe9080f70e5252936832b13afe CI 1659736228 +1000 commit (initial): file1 diff --git a/test/integration/stagingForcedToggle/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/stagingForcedToggle/expected/repo/.git_keep/logs/refs/heads/master deleted file mode 100644 index e60ea548f..000000000 --- a/test/integration/stagingForcedToggle/expected/repo/.git_keep/logs/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -0000000000000000000000000000000000000000 de59eafcc9bdb8fe9080f70e5252936832b13afe CI 1659736228 +1000 commit (initial): file1 diff --git a/test/integration/stagingForcedToggle/expected/repo/.git_keep/objects/15/8e9a9c1a9627ea0ef4de8b00a503ed0f80a09e b/test/integration/stagingForcedToggle/expected/repo/.git_keep/objects/15/8e9a9c1a9627ea0ef4de8b00a503ed0f80a09e deleted file mode 100644 index 2c00719b0..000000000 Binary files a/test/integration/stagingForcedToggle/expected/repo/.git_keep/objects/15/8e9a9c1a9627ea0ef4de8b00a503ed0f80a09e and /dev/null differ diff --git a/test/integration/stagingForcedToggle/expected/repo/.git_keep/objects/7b/9c2149f16c706cea79b03234cb67fde7e9b68f b/test/integration/stagingForcedToggle/expected/repo/.git_keep/objects/7b/9c2149f16c706cea79b03234cb67fde7e9b68f deleted file mode 100644 index 611ed37a4..000000000 Binary files a/test/integration/stagingForcedToggle/expected/repo/.git_keep/objects/7b/9c2149f16c706cea79b03234cb67fde7e9b68f and /dev/null differ diff --git a/test/integration/stagingForcedToggle/expected/repo/.git_keep/objects/80/b489d1f5a71c3e46c7e1a82fe264ffb0a4726f b/test/integration/stagingForcedToggle/expected/repo/.git_keep/objects/80/b489d1f5a71c3e46c7e1a82fe264ffb0a4726f deleted file mode 100644 index 992d06341..000000000 Binary files a/test/integration/stagingForcedToggle/expected/repo/.git_keep/objects/80/b489d1f5a71c3e46c7e1a82fe264ffb0a4726f and /dev/null differ diff --git a/test/integration/stagingForcedToggle/expected/repo/.git_keep/objects/bb/e897baa83fd0099ba30daf3a97edc97d8c86b5 b/test/integration/stagingForcedToggle/expected/repo/.git_keep/objects/bb/e897baa83fd0099ba30daf3a97edc97d8c86b5 deleted file mode 100644 index b878ef1b2..000000000 Binary files a/test/integration/stagingForcedToggle/expected/repo/.git_keep/objects/bb/e897baa83fd0099ba30daf3a97edc97d8c86b5 and /dev/null differ diff --git a/test/integration/stagingForcedToggle/expected/repo/.git_keep/objects/c3/323cfc94775013acea4145545f47ac1af5c9d2 b/test/integration/stagingForcedToggle/expected/repo/.git_keep/objects/c3/323cfc94775013acea4145545f47ac1af5c9d2 deleted file mode 100644 index 530b393a0..000000000 Binary files a/test/integration/stagingForcedToggle/expected/repo/.git_keep/objects/c3/323cfc94775013acea4145545f47ac1af5c9d2 and /dev/null differ diff --git a/test/integration/stagingForcedToggle/expected/repo/.git_keep/objects/de/59eafcc9bdb8fe9080f70e5252936832b13afe b/test/integration/stagingForcedToggle/expected/repo/.git_keep/objects/de/59eafcc9bdb8fe9080f70e5252936832b13afe deleted file mode 100644 index 1aa8bed57..000000000 Binary files a/test/integration/stagingForcedToggle/expected/repo/.git_keep/objects/de/59eafcc9bdb8fe9080f70e5252936832b13afe and /dev/null differ diff --git a/test/integration/stagingForcedToggle/expected/repo/.git_keep/refs/heads/master b/test/integration/stagingForcedToggle/expected/repo/.git_keep/refs/heads/master deleted file mode 100644 index c9e76c463..000000000 --- a/test/integration/stagingForcedToggle/expected/repo/.git_keep/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -de59eafcc9bdb8fe9080f70e5252936832b13afe diff --git a/test/integration/stagingForcedToggle/expected/repo/one.txt b/test/integration/stagingForcedToggle/expected/repo/one.txt deleted file mode 100644 index c3323cfc9..000000000 --- a/test/integration/stagingForcedToggle/expected/repo/one.txt +++ /dev/null @@ -1,67 +0,0 @@ -package oscommands - -import ( - "github.com/jesseduffield/lazygit/pkg/common" - "github.com/jesseduffield/lazygit/pkg/utils" -) - -// NewDummyOSCommand creates a new dummy OSCommand for testing -func NewDummyOSCommand() *OSCommand { - osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - - return osCmd -} - -type OSCommandDeps struct { - Common *common.Common - Platform *Platform - GetenvFn func(string) string - RemoveFileFn func(string) error - Cmd *CmdObjBuilder -} - -func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand { - if deps.Cmd == nil { - panic("WHAT") - } - common := deps.Common - if common == nil { - common = utils.NewDummyCommon() - } - - platform := deps.Platform - if platform == nil { - platform = dummyPlatform - } - - return &OSCommand{ - Common: common, - Platform: platform, - getenvFn: deps.GetenvFn, - removeFileFn: deps.RemoveFileFn, - guiIO: NewNullGuiIO(utils.NewDummyLog()), - Cmd: deps.Cmd, - } -} - -func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { - return &CmdObjBuilder{ - runner: runner, - platform: dummyPlatform, - } -} - -var dummyPlatform = &Platform{ - OS: "darwin", - Shell: "bash", - ShellArg: "-c", - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", -} - -func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand { - osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - osCommand.Cmd = NewDummyCmdObjBuilder(runner) - - return osCommand -} diff --git a/test/integration/stagingForcedToggle/files/one.txt b/test/integration/stagingForcedToggle/files/one.txt deleted file mode 100644 index 158e9a9c1..000000000 --- a/test/integration/stagingForcedToggle/files/one.txt +++ /dev/null @@ -1,63 +0,0 @@ -package oscommands - -import ( - "github.com/jesseduffield/lazygit/pkg/common" - "github.com/jesseduffield/lazygit/pkg/utils" -) - -// NewDummyOSCommand creates a new dummy OSCommand for testing -func NewDummyOSCommand() *OSCommand { - osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - - return osCmd -} - -type OSCommandDeps struct { - Common *common.Common - Platform *Platform - GetenvFn func(string) string - RemoveFileFn func(string) error - Cmd *CmdObjBuilder -} - -func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand { - common := deps.Common - if common == nil { - common = utils.NewDummyCommon() - } - - platform := deps.Platform - if platform == nil { - platform = dummyPlatform - } - - return &OSCommand{ - Common: common, - Platform: platform, - getenvFn: deps.GetenvFn, - removeFileFn: deps.RemoveFileFn, - guiIO: NewNullGuiIO(utils.NewDummyLog()), - } -} - -func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { - return &CmdObjBuilder{ - runner: runner, - platform: dummyPlatform, - } -} - -var dummyPlatform = &Platform{ - OS: "darwin", - Shell: "bash", - ShellArg: "-c", - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", -} - -func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand { - osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - osCommand.Cmd = NewDummyCmdObjBuilder(runner) - - return osCommand -} diff --git a/test/integration/stagingForcedToggle/files/one_new.txt b/test/integration/stagingForcedToggle/files/one_new.txt deleted file mode 100644 index c3323cfc9..000000000 --- a/test/integration/stagingForcedToggle/files/one_new.txt +++ /dev/null @@ -1,67 +0,0 @@ -package oscommands - -import ( - "github.com/jesseduffield/lazygit/pkg/common" - "github.com/jesseduffield/lazygit/pkg/utils" -) - -// NewDummyOSCommand creates a new dummy OSCommand for testing -func NewDummyOSCommand() *OSCommand { - osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - - return osCmd -} - -type OSCommandDeps struct { - Common *common.Common - Platform *Platform - GetenvFn func(string) string - RemoveFileFn func(string) error - Cmd *CmdObjBuilder -} - -func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand { - if deps.Cmd == nil { - panic("WHAT") - } - common := deps.Common - if common == nil { - common = utils.NewDummyCommon() - } - - platform := deps.Platform - if platform == nil { - platform = dummyPlatform - } - - return &OSCommand{ - Common: common, - Platform: platform, - getenvFn: deps.GetenvFn, - removeFileFn: deps.RemoveFileFn, - guiIO: NewNullGuiIO(utils.NewDummyLog()), - Cmd: deps.Cmd, - } -} - -func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { - return &CmdObjBuilder{ - runner: runner, - platform: dummyPlatform, - } -} - -var dummyPlatform = &Platform{ - OS: "darwin", - Shell: "bash", - ShellArg: "-c", - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", -} - -func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand { - osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog())) - osCommand.Cmd = NewDummyCmdObjBuilder(runner) - - return osCommand -} diff --git a/test/integration/stagingForcedToggle/recording.json b/test/integration/stagingForcedToggle/recording.json deleted file mode 100644 index 11e83b51c..000000000 --- a/test/integration/stagingForcedToggle/recording.json +++ /dev/null @@ -1 +0,0 @@ -{"KeyEvents":[{"Timestamp":508,"Mod":0,"Key":13,"Ch":13},{"Timestamp":804,"Mod":0,"Key":256,"Ch":97},{"Timestamp":1094,"Mod":0,"Key":256,"Ch":32},{"Timestamp":1429,"Mod":0,"Key":256,"Ch":32},{"Timestamp":2398,"Mod":0,"Key":256,"Ch":32},{"Timestamp":3060,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":118,"Height":61}]} \ No newline at end of file diff --git a/test/integration/stagingForcedToggle/setup.sh b/test/integration/stagingForcedToggle/setup.sh deleted file mode 100644 index 9b1f6fb8c..000000000 --- a/test/integration/stagingForcedToggle/setup.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -set -e - -cd $1 - -git init - -git config user.email "CI@example.com" -git config user.name "CI" - -cp ../../files/one.txt one.txt -git add . -git commit -am file1 - -cp ../../files/one_new.txt one.txt diff --git a/test/integration/stagingForcedToggle/test.json b/test/integration/stagingForcedToggle/test.json deleted file mode 100644 index 1f59de864..000000000 --- a/test/integration/stagingForcedToggle/test.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "description": "stage everything in a file so that you're forced to switch focus to the secondary panel", - "speed": 20 -}