config

package
v0.49.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CustomCommandsInPerRepoConfig = NewIntegrationTest(NewIntegrationTestArgs{
	Description:  "Custom commands in per-repo config add to the global ones instead of replacing them",
	ExtraCmdArgs: []string{},
	Skip:         false,
	SetupConfig: func(cfg *config.AppConfig) {
		otherRepo, _ := filepath.Abs("../other")
		cfg.GetAppState().RecentRepos = []string{otherRepo}

		cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
			{
				Key:     "X",
				Context: "global",
				Command: "printf 'global X' > file.txt",
			},
			{
				Key:     "Y",
				Context: "global",
				Command: "printf 'global Y' > file.txt",
			},
		}
	},
	SetupRepo: func(shell *Shell) {
		shell.CloneNonBare("other")
		shell.CreateFile("../other/.git/lazygit.yml", `
customCommands:
  - key: Y
    context: global
    command: printf 'local Y' > file.txt
  - key: Z
    context: global
    command: printf 'local Z' > file.txt`)
	},
	Run: func(t *TestDriver, keys config.KeybindingConfig) {
		t.GlobalPress(keys.Universal.OpenRecentRepos)
		t.ExpectPopup().Menu().Title(Equals("Recent repositories")).
			Lines(
				Contains("other").IsSelected(),
				Contains("Cancel"),
			).Confirm()
		t.Views().Status().Content(Contains("other → master"))

		t.GlobalPress("X")
		t.FileSystem().FileContent("../other/file.txt", Equals("global X"))

		t.GlobalPress("Y")
		t.FileSystem().FileContent("../other/file.txt", Equals("local Y"))

		t.GlobalPress("Z")
		t.FileSystem().FileContent("../other/file.txt", Equals("local Z"))
	},
})
View Source
var NegativeRefspec = NewIntegrationTest(NewIntegrationTestArgs{
	Description:  "Having a config with a negative refspec",
	ExtraCmdArgs: []string{},
	GitVersion:   AtLeast("2.29.0"),
	SetupRepo: func(shell *Shell) {
		shell.
			SetConfig("remote.origin.fetch", "^refs/heads/test").
			CreateNCommits(2)
	},
	SetupConfig: func(cfg *config.AppConfig) {},
	Run: func(t *TestDriver, keys config.KeybindingConfig) {

		t.Views().Branches().
			Lines(
				Contains("master"),
			)
	},
})
View Source
var RemoteNamedStar = NewIntegrationTest(NewIntegrationTestArgs{
	Description:  "Having a config remote.*",
	ExtraCmdArgs: []string{},
	Skip:         false,
	SetupRepo: func(shell *Shell) {
		shell.
			SetConfig("remote.*.prune", "true").
			CreateNCommits(2)
	},
	SetupConfig: func(cfg *config.AppConfig) {},
	Run: func(t *TestDriver, keys config.KeybindingConfig) {

		t.Views().Commits().
			Lines(
				AnyString(),
				AnyString(),
			)
	},
})

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL