repo
stringlengths
6
47
file_url
stringlengths
77
269
file_path
stringlengths
5
186
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-07 08:35:43
2026-01-07 08:55:24
truncated
bool
2 classes
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/logs/tail/tail.go
pkg/logs/tail/tail.go
package tail import ( "fmt" "log" "os" "github.com/aybabtme/humanlog" ) // TailLogs lets us run `lazygit --logs` to print the logs produced by other lazygit processes. // This makes for easier debugging. func TailLogs(logFilePath string) { fmt.Printf("Tailing log file %s\n\n", logFilePath) opts := humanlog.DefaultOptions opts.Truncates = false _, err := os.Stat(logFilePath) if err != nil { if os.IsNotExist(err) { log.Fatal("Log file does not exist. Run `lazygit --debug` first to create the log file") } log.Fatal(err) } tailLogsForPlatform(logFilePath, opts) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/logs/tail/logs_windows.go
pkg/logs/tail/logs_windows.go
package tail import ( "bufio" "log" "os" "strings" "time" "github.com/aybabtme/humanlog" ) func tailLogsForPlatform(logFilePath string, opts *humanlog.HandlerOptions) { var lastModified int64 = 0 var lastOffset int64 = 0 for { stat, err := os.Stat(logFilePath) if err != nil { log.Fatal(err) } if stat.ModTime().Unix() > lastModified { err = tailFrom(lastOffset, logFilePath, opts) if err != nil { log.Fatal(err) } } lastOffset = stat.Size() time.Sleep(1 * time.Second) } } func openAndSeek(filepath string, offset int64) (*os.File, error) { file, err := os.Open(filepath) if err != nil { return nil, err } _, err = file.Seek(offset, 0) if err != nil { _ = file.Close() return nil, err } return file, nil } func tailFrom(lastOffset int64, logFilePath string, opts *humanlog.HandlerOptions) error { file, err := openAndSeek(logFilePath, lastOffset) if err != nil { return err } fileScanner := bufio.NewScanner(file) var lines []string for fileScanner.Scan() { lines = append(lines, fileScanner.Text()) } file.Close() lineCount := len(lines) lastTen := lines if lineCount > 10 { lastTen = lines[lineCount-10:] } for _, line := range lastTen { reader := strings.NewReader(line) if err := humanlog.Scanner(reader, os.Stdout, opts); err != nil { log.Fatal(err) } } return nil }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/logs/tail/logs_default.go
pkg/logs/tail/logs_default.go
//go:build !windows package tail import ( "log" "os" "os/exec" "github.com/aybabtme/humanlog" ) func tailLogsForPlatform(logFilePath string, opts *humanlog.HandlerOptions) { cmd := exec.Command("tail", "-f", logFilePath) stdout, _ := cmd.StdoutPipe() if err := cmd.Start(); err != nil { log.Fatal(err) } if err := humanlog.Scanner(stdout, os.Stdout, opts); err != nil { log.Fatal(err) } if err := cmd.Wait(); err != nil { log.Fatal(err) } os.Exit(0) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/jsonschema/generate_config_docs.go
pkg/jsonschema/generate_config_docs.go
package jsonschema import ( "bytes" "errors" "fmt" "os" "strings" "github.com/jesseduffield/lazycore/pkg/utils" "github.com/karimkhaleel/jsonschema" "github.com/samber/lo" "gopkg.in/yaml.v3" ) type Node struct { Name string Description string Default any Children []*Node } const ( IndentLevel = 2 DocumentationCommentStart = "<!-- START CONFIG YAML: AUTOMATICALLY GENERATED with `go generate ./..., DO NOT UPDATE MANUALLY -->\n" DocumentationCommentEnd = "<!-- END CONFIG YAML -->" DocumentationCommentStartLen = len(DocumentationCommentStart) ) func insertBlankLines(buffer bytes.Buffer) bytes.Buffer { lines := strings.Split(strings.TrimRight(buffer.String(), "\n"), "\n") var newBuffer bytes.Buffer previousIndent := -1 wasComment := false for _, line := range lines { trimmedLine := strings.TrimLeft(line, " ") indent := len(line) - len(trimmedLine) isComment := strings.HasPrefix(trimmedLine, "#") if isComment && !wasComment && indent <= previousIndent { newBuffer.WriteString("\n") } newBuffer.WriteString(line) newBuffer.WriteString("\n") previousIndent = indent wasComment = isComment } return newBuffer } func prepareMarshalledConfig(buffer bytes.Buffer) []byte { buffer = insertBlankLines(buffer) // Remove all `---` lines lines := strings.Split(strings.TrimRight(buffer.String(), "\n"), "\n") var newBuffer bytes.Buffer for _, line := range lines { if strings.TrimSpace(line) != "---" { newBuffer.WriteString(line) newBuffer.WriteString("\n") } } config := newBuffer.Bytes() // Add markdown yaml block tag config = append([]byte("```yaml\n"), config...) config = append(config, []byte("```\n")...) return config } func wrapLine(line string, maxLineLength int) []string { result := []string{} startOfLine := 0 lastSpaceIdx := -1 for i, r := range line { // Don't break on "See https://..." lines if r == ' ' && line[startOfLine:i] != "See" { lastSpaceIdx = i + 1 } else if i-startOfLine >= maxLineLength && lastSpaceIdx != -1 { result = append(result, line[startOfLine:lastSpaceIdx-1]) startOfLine = lastSpaceIdx lastSpaceIdx = -1 } } result = append(result, line[startOfLine:]) return result } func setComment(yamlNode *yaml.Node, description string) { lines := strings.Split(description, "\n") wrappedLines := lo.Flatten(lo.Map(lines, func(line string, _ int) []string { return wrapLine(line, 78) })) // Workaround for the way yaml formats the HeadComment if it contains // blank lines: it renders these without a leading "#", but we want a // leading "#" even on blank lines. However, yaml respects it if the // HeadComment already contains a leading "#", so we prefix all lines // (including blank ones) with "#". yamlNode.HeadComment = strings.Join( lo.Map(wrappedLines, func(s string, _ int) string { if s == "" { return "#" // avoid trailing space on blank lines } return "# " + s }), "\n") } func (n *Node) MarshalYAML() (any, error) { node := yaml.Node{ Kind: yaml.MappingNode, } keyNode := yaml.Node{ Kind: yaml.ScalarNode, Value: n.Name, } if n.Description != "" { setComment(&keyNode, n.Description) } if len(n.Children) > 0 { childrenNode := yaml.Node{ Kind: yaml.MappingNode, } for _, child := range n.Children { childYaml, err := child.MarshalYAML() if err != nil { return nil, err } childKey := yaml.Node{ Kind: yaml.ScalarNode, Value: child.Name, } if child.Description != "" { setComment(&childKey, child.Description) } childYaml = childYaml.(*yaml.Node) childrenNode.Content = append(childrenNode.Content, childYaml.(*yaml.Node).Content...) } node.Content = append(node.Content, &keyNode, &childrenNode) } else { valueNode := yaml.Node{ Kind: yaml.ScalarNode, } err := valueNode.Encode(n.Default) if err != nil { return nil, err } node.Content = append(node.Content, &keyNode, &valueNode) } return &node, nil } func writeToConfigDocs(config []byte) error { configPath := utils.GetLazyRootDirectory() + "/docs-master/Config.md" markdown, err := os.ReadFile(configPath) if err != nil { return fmt.Errorf("Error reading Config.md file %w", err) } startConfigSectionIndex := bytes.Index(markdown, []byte(DocumentationCommentStart)) if startConfigSectionIndex == -1 { return errors.New("Default config starting comment not found") } endConfigSectionIndex := bytes.Index(markdown[startConfigSectionIndex+DocumentationCommentStartLen:], []byte(DocumentationCommentEnd)) if endConfigSectionIndex == -1 { return errors.New("Default config closing comment not found") } endConfigSectionIndex = endConfigSectionIndex + startConfigSectionIndex + DocumentationCommentStartLen newMarkdown := make([]byte, 0, len(markdown)-endConfigSectionIndex+startConfigSectionIndex+len(config)) newMarkdown = append(newMarkdown, markdown[:startConfigSectionIndex+DocumentationCommentStartLen]...) newMarkdown = append(newMarkdown, config...) newMarkdown = append(newMarkdown, markdown[endConfigSectionIndex:]...) if err := os.WriteFile(configPath, newMarkdown, 0o644); err != nil { return fmt.Errorf("Error writing to file %w", err) } return nil } func GenerateConfigDocs(schema *jsonschema.Schema) { rootNode := &Node{ Children: make([]*Node, 0), } recurseOverSchema(schema, schema.Definitions["UserConfig"], rootNode) var buffer bytes.Buffer encoder := yaml.NewEncoder(&buffer) encoder.SetIndent(IndentLevel) for _, child := range rootNode.Children { err := encoder.Encode(child) if err != nil { panic("Failed to Marshal document") } } encoder.Close() config := prepareMarshalledConfig(buffer) err := writeToConfigDocs(config) if err != nil { panic(err) } } func recurseOverSchema(rootSchema, schema *jsonschema.Schema, parent *Node) { if schema == nil || schema.Properties == nil || schema.Properties.Len() == 0 { return } for pair := schema.Properties.Oldest(); pair != nil; pair = pair.Next() { subSchema := getSubSchema(rootSchema, schema, pair.Key) if strings.Contains(strings.ToLower(subSchema.Description), "deprecated") { continue } node := Node{ Name: pair.Key, Description: subSchema.Description, Default: getZeroValue(subSchema.Default, subSchema.Type), } parent.Children = append(parent.Children, &node) recurseOverSchema(rootSchema, subSchema, &node) } } func getZeroValue(val any, t string) any { if !isZeroValue(val) { return val } switch t { case "string": return "" case "boolean": return false case "object": return map[string]any{} case "array": return []any{} default: return nil } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/jsonschema/generator.go
pkg/jsonschema/generator.go
//go:build ignore package main import ( "fmt" "github.com/jesseduffield/lazygit/pkg/jsonschema" ) func main() { fmt.Printf("Generating jsonschema in %s...\n", jsonschema.GetSchemaDir()) schema := jsonschema.GenerateSchema() jsonschema.GenerateConfigDocs(schema) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/jsonschema/generate.go
pkg/jsonschema/generate.go
//go:generate go run generator.go package jsonschema import ( "encoding/json" "fmt" "os" "reflect" "strings" "github.com/jesseduffield/lazycore/pkg/utils" "github.com/jesseduffield/lazygit/pkg/config" "github.com/karimkhaleel/jsonschema" "github.com/samber/lo" ) func GetSchemaDir() string { return utils.GetLazyRootDirectory() + "/schema-master" } func GenerateSchema() *jsonschema.Schema { schema := customReflect(&config.UserConfig{}) obj, _ := json.MarshalIndent(schema, "", " ") obj = append(obj, '\n') if err := os.WriteFile(GetSchemaDir()+"/config.json", obj, 0o644); err != nil { fmt.Println("Error writing to file:", err) return nil } return schema } func getSubSchema(rootSchema, parentSchema *jsonschema.Schema, key string) *jsonschema.Schema { subSchema, found := parentSchema.Properties.Get(key) if !found { panic(fmt.Sprintf("Failed to find subSchema at %s on parent", key)) } // This means the schema is defined on the rootSchema's Definitions if subSchema.Ref != "" { key, _ = strings.CutPrefix(subSchema.Ref, "#/$defs/") refSchema, ok := rootSchema.Definitions[key] if !ok { panic(fmt.Sprintf("Failed to find #/$defs/%s", key)) } refSchema.Description = subSchema.Description return refSchema } return subSchema } func customReflect(v *config.UserConfig) *jsonschema.Schema { r := &jsonschema.Reflector{FieldNameTag: "yaml", RequiredFromJSONSchemaTags: true} if err := r.AddGoComments("github.com/jesseduffield/lazygit/pkg/config", "../config"); err != nil { panic(err) } filterOutDevComments(r) schema := r.Reflect(v) defaultConfig := config.GetDefaultConfig() userConfigSchema := schema.Definitions["UserConfig"] defaultValue := reflect.ValueOf(defaultConfig).Elem() yamlToFieldNames := lo.Invert(userConfigSchema.OriginalPropertiesMapping) for pair := userConfigSchema.Properties.Oldest(); pair != nil; pair = pair.Next() { yamlName := pair.Key fieldName := yamlToFieldNames[yamlName] subSchema := getSubSchema(schema, userConfigSchema, yamlName) setDefaultVals(schema, subSchema, defaultValue.FieldByName(fieldName).Interface()) } return schema } func filterOutDevComments(r *jsonschema.Reflector) { for k, v := range r.CommentMap { commentLines := strings.Split(v, "\n") filteredCommentLines := lo.Filter(commentLines, func(line string, _ int) bool { return !strings.Contains(line, "[dev]") }) r.CommentMap[k] = strings.Join(filteredCommentLines, "\n") } } func setDefaultVals(rootSchema, schema *jsonschema.Schema, defaults any) { t := reflect.TypeOf(defaults) v := reflect.ValueOf(defaults) if t.Kind() == reflect.Ptr || t.Kind() == reflect.Interface { t = t.Elem() v = v.Elem() } k := t.Kind() _ = k switch t.Kind() { case reflect.Bool: schema.Default = v.Bool() case reflect.Int: schema.Default = v.Int() case reflect.String: schema.Default = v.String() default: // Do nothing } if t.Kind() != reflect.Struct { return } for i := range t.NumField() { value := v.Field(i).Interface() parentKey := t.Field(i).Name key, ok := schema.OriginalPropertiesMapping[parentKey] if !ok { continue } subSchema := getSubSchema(rootSchema, schema, key) if isStruct(value) { setDefaultVals(rootSchema, subSchema, value) } else if !isZeroValue(value) { subSchema.Default = value } } } func isZeroValue(v any) bool { switch v := v.(type) { case int, int32, int64, float32, float64: return v == 0 case string: return v == "" case bool: return false case nil: return true } rv := reflect.ValueOf(v) switch rv.Kind() { case reflect.Slice, reflect.Map: return rv.Len() == 0 case reflect.Ptr, reflect.Interface: return rv.IsNil() case reflect.Struct: for i := range rv.NumField() { if !isZeroValue(rv.Field(i).Interface()) { return false } } return true default: return false } } func isStruct(v any) bool { return reflect.TypeOf(v).Kind() == reflect.Struct }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/test_list_generator.go
pkg/integration/tests/test_list_generator.go
//go:build ignore // This file is invoked with `go generate ./...` and it generates the test_list.go file // The test_list.go file is a list of all the integration tests. // It's annoying to have to manually add an entry in that file for each test you // create, so this generator is here to make the process easier. package main import ( "bytes" "fmt" "go/format" "io/fs" "os" "strings" "github.com/samber/lo" ) func main() { println("Generating test_list.go...") code := generateCode() formattedCode, err := format.Source(code) if err != nil { panic(err) } if err := os.WriteFile("test_list.go", formattedCode, 0o644); err != nil { panic(err) } } func generateCode() []byte { // traverse parent directory to get all sibling directories directories, err := os.ReadDir("../tests") if err != nil { panic(err) } directories = lo.Filter(directories, func(file fs.DirEntry, _ int) bool { // 'shared' is a special folder containing shared test code so we // ignore it here return file.IsDir() && file.Name() != "shared" }) var buf bytes.Buffer fmt.Fprintf(&buf, "// THIS FILE IS AUTO-GENERATED. You can regenerate it by running `go generate ./...` at the root of the lazygit repo.\n\n") fmt.Fprintf(&buf, "package tests\n\n") fmt.Fprintf(&buf, "import (\n") fmt.Fprintf(&buf, "\t\"github.com/jesseduffield/lazygit/pkg/integration/components\"\n") for _, dir := range directories { fmt.Fprintf(&buf, "\t\"github.com/jesseduffield/lazygit/pkg/integration/tests/%s\"\n", dir.Name()) } fmt.Fprintf(&buf, ")\n\n") fmt.Fprintf(&buf, "var tests = []*components.IntegrationTest{\n") for _, dir := range directories { appendDirTests(dir, &buf) } fmt.Fprintf(&buf, "}\n") return buf.Bytes() } func appendDirTests(dir fs.DirEntry, buf *bytes.Buffer) { files, err := os.ReadDir(fmt.Sprintf("../tests/%s", dir.Name())) if err != nil { panic(err) } for _, file := range files { if file.IsDir() || !strings.HasSuffix(file.Name(), ".go") { continue } testName := snakeToPascal( strings.TrimSuffix(file.Name(), ".go"), ) fileContents, err := os.ReadFile(fmt.Sprintf("../tests/%s/%s", dir.Name(), file.Name())) if err != nil { panic(err) } fileContentsStr := string(fileContents) if !strings.Contains(fileContentsStr, "NewIntegrationTest(") { // the file does not define a test so it probably just contains shared test code continue } if !strings.Contains(fileContentsStr, fmt.Sprintf("var %s = NewIntegrationTest(NewIntegrationTestArgs{", testName)) { panic(fmt.Sprintf("expected test %s to be defined in file %s. Perhaps you misspelt it? The name of the test should be the name of the file but converted from snake_case to PascalCase", testName, file.Name())) } fmt.Fprintf(buf, "\t%s.%s,\n", dir.Name(), testName) } } // thanks ChatGPT func snakeToPascal(s string) string { // Split the input string into words. words := strings.Split(s, "_") // Convert the first letter of each word to uppercase and concatenate them. var builder strings.Builder for _, w := range words { if len(w) > 0 { builder.WriteString(strings.ToUpper(w[:1])) builder.WriteString(w[1:]) } } return builder.String() }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/tests.go
pkg/integration/tests/tests.go
//go:generate go run test_list_generator.go package tests import ( "fmt" "os" "path/filepath" "strings" "github.com/jesseduffield/generics/set" "github.com/jesseduffield/lazygit/pkg/integration/components" "github.com/samber/lo" ) func GetTests(lazygitRootDir string) []*components.IntegrationTest { // first we ensure that each test in this directory has actually been added to the above list. testCount := 0 testNamesSet := set.NewFromSlice(lo.Map( tests, func(test *components.IntegrationTest, _ int) string { return test.Name() }, )) missingTestNames := []string{} if err := filepath.Walk(filepath.Join(lazygitRootDir, "pkg/integration/tests"), func(path string, info os.FileInfo, err error) error { if !info.IsDir() && strings.HasSuffix(path, ".go") { // ignoring non-test files if filepath.Base(path) == "tests.go" || filepath.Base(path) == "test_list.go" || filepath.Base(path) == "test_list_generator.go" { return nil } // the shared directory won't itself contain tests: only shared helper functions if filepath.Base(filepath.Dir(path)) == "shared" { return nil } // any file named shared.go will also be ignored, because those files are only used for shared helper functions if filepath.Base(path) == "shared.go" { return nil } nameFromPath := components.TestNameFromFilePath(path) if !testNamesSet.Includes(nameFromPath) { missingTestNames = append(missingTestNames, nameFromPath) } testCount++ } return nil }); err != nil { panic(fmt.Sprintf("failed to walk tests: %v", err)) } if len(missingTestNames) > 0 { panic(fmt.Sprintf("The following tests are missing from the list of tests: %s. You need to add them to `pkg/integration/tests/test_list.go`. Use `go generate ./...` to regenerate the tests list.", strings.Join(missingTestNames, ", "))) } if testCount > len(tests) { panic("you have not added all of the tests to the tests list in `pkg/integration/tests/test_list.go`. Use `go generate ./...` to regenerate the tests list.") } else if testCount < len(tests) { panic("There are more tests in `pkg/integration/tests/test_list.go` than there are test files in the tests directory. Ensure that you only have one test per file and you haven't included the same test twice in the tests list. Use `go generate ./...` to regenerate the tests list.") } return tests }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/test_list.go
pkg/integration/tests/test_list.go
// THIS FILE IS AUTO-GENERATED. You can regenerate it by running `go generate ./...` at the root of the lazygit repo. package tests import ( "github.com/jesseduffield/lazygit/pkg/integration/components" "github.com/jesseduffield/lazygit/pkg/integration/tests/bisect" "github.com/jesseduffield/lazygit/pkg/integration/tests/branch" "github.com/jesseduffield/lazygit/pkg/integration/tests/cherry_pick" "github.com/jesseduffield/lazygit/pkg/integration/tests/commit" "github.com/jesseduffield/lazygit/pkg/integration/tests/config" "github.com/jesseduffield/lazygit/pkg/integration/tests/conflicts" "github.com/jesseduffield/lazygit/pkg/integration/tests/custom_commands" "github.com/jesseduffield/lazygit/pkg/integration/tests/demo" "github.com/jesseduffield/lazygit/pkg/integration/tests/diff" "github.com/jesseduffield/lazygit/pkg/integration/tests/file" "github.com/jesseduffield/lazygit/pkg/integration/tests/filter_and_search" "github.com/jesseduffield/lazygit/pkg/integration/tests/filter_by_author" "github.com/jesseduffield/lazygit/pkg/integration/tests/filter_by_path" "github.com/jesseduffield/lazygit/pkg/integration/tests/interactive_rebase" "github.com/jesseduffield/lazygit/pkg/integration/tests/misc" "github.com/jesseduffield/lazygit/pkg/integration/tests/patch_building" "github.com/jesseduffield/lazygit/pkg/integration/tests/reflog" "github.com/jesseduffield/lazygit/pkg/integration/tests/remote" "github.com/jesseduffield/lazygit/pkg/integration/tests/shell_commands" "github.com/jesseduffield/lazygit/pkg/integration/tests/staging" "github.com/jesseduffield/lazygit/pkg/integration/tests/stash" "github.com/jesseduffield/lazygit/pkg/integration/tests/status" "github.com/jesseduffield/lazygit/pkg/integration/tests/submodule" "github.com/jesseduffield/lazygit/pkg/integration/tests/sync" "github.com/jesseduffield/lazygit/pkg/integration/tests/tag" "github.com/jesseduffield/lazygit/pkg/integration/tests/ui" "github.com/jesseduffield/lazygit/pkg/integration/tests/undo" "github.com/jesseduffield/lazygit/pkg/integration/tests/worktree" ) var tests = []*components.IntegrationTest{ bisect.Basic, bisect.ChooseTerms, bisect.FromOtherBranch, bisect.Skip, branch.CheckoutAutostash, branch.CheckoutByName, branch.CheckoutPreviousBranch, branch.CreateTag, branch.Delete, branch.DeleteMultiple, branch.DeleteRemoteBranchWhenTagWithSameNameExists, branch.DeleteRemoteBranchWithCredentialPrompt, branch.DeleteRemoteBranchWithDifferentName, branch.DeleteWhileFiltering, branch.DetachedHead, branch.MergeFastForward, branch.MergeNonFastForward, branch.MoveCommitsToNewBranchFromBaseBranch, branch.MoveCommitsToNewBranchFromMainBranch, branch.MoveCommitsToNewBranchKeepStacked, branch.NewBranchAutostash, branch.NewBranchFromRemoteTrackingDifferentName, branch.NewBranchFromRemoteTrackingSameName, branch.NewBranchWithPrefix, branch.NewBranchWithPrefixUsingRunCommand, branch.OpenPullRequestInvalidTargetRemoteName, branch.OpenPullRequestNoUpstream, branch.OpenPullRequestSelectRemoteAndTargetBranch, branch.OpenWithCliArg, branch.Rebase, branch.RebaseAbortOnConflict, branch.RebaseAndDrop, branch.RebaseCancelOnConflict, branch.RebaseConflictsFixBuildErrors, branch.RebaseCopiedBranch, branch.RebaseDoesNotAutosquash, branch.RebaseFromMarkedBase, branch.RebaseOntoBaseBranch, branch.RebaseToUpstream, branch.Rename, branch.Reset, branch.ResetToDuplicateNamedTag, branch.ResetToDuplicateNamedUpstream, branch.ResetToUpstream, branch.SelectCommitsOfCurrentBranch, branch.SetUpstream, branch.ShowDivergenceFromBaseBranch, branch.ShowDivergenceFromUpstream, branch.ShowDivergenceFromUpstreamNoDivergence, branch.SortLocalBranches, branch.SortRemoteBranches, branch.SquashMerge, branch.Suggestions, branch.UnsetUpstream, cherry_pick.CherryPick, cherry_pick.CherryPickCommitThatBecomesEmpty, cherry_pick.CherryPickConflicts, cherry_pick.CherryPickConflictsEmptyCommitAfterResolving, cherry_pick.CherryPickDuringRebase, cherry_pick.CherryPickMerge, cherry_pick.CherryPickRange, commit.AddCoAuthor, commit.AddCoAuthorRange, commit.AddCoAuthorWhileCommitting, commit.Amend, commit.AmendWhenThereAreConflictsAndAmend, commit.AmendWhenThereAreConflictsAndCancel, commit.AmendWhenThereAreConflictsAndContinue, commit.AutoWrapMessage, commit.Checkout, commit.CheckoutFileFromCommit, commit.CheckoutFileFromRangeSelectionOfCommits, commit.CheckoutFileWithLocalModifications, commit.Commit, commit.CommitMultiline, commit.CommitSkipHooks, commit.CommitSwitchToEditor, commit.CommitSwitchToEditorSkipHooks, commit.CommitWipWithPrefix, commit.CommitWithFallthroughPrefix, commit.CommitWithGlobalPrefix, commit.CommitWithNonMatchingBranchName, commit.CommitWithPrefix, commit.CopyAuthorToClipboard, commit.CopyMessageBodyToClipboard, commit.CopyTagToClipboard, commit.CreateAmendCommit, commit.CreateFixupCommitInBranchStack, commit.CreateTag, commit.DisableCopyCommitMessageBody, commit.DiscardOldFileChanges, commit.DiscardSubmoduleChanges, commit.DoNotShowBranchMarkerForHeadCommit, commit.FailHooksThenCommitNoHooks, commit.FindBaseCommitForFixup, commit.FindBaseCommitForFixupDisregardMainBranch, commit.FindBaseCommitForFixupOnlyAddedLines, commit.FindBaseCommitForFixupWarningForAddedLines, commit.Highlight, commit.History, commit.HistoryComplex, commit.NewBranch, commit.PasteCommitMessage, commit.PasteCommitMessageOverExisting, commit.PreserveCommitMessage, commit.ResetAuthor, commit.ResetAuthorRange, commit.Revert, commit.RevertMerge, commit.RevertWithConflictMultipleCommits, commit.RevertWithConflictSingleCommit, commit.Reword, commit.Search, commit.SetAuthor, commit.SetAuthorRange, commit.StageRangeOfLines, commit.Staged, commit.StagedWithoutHooks, commit.Unstaged, config.CustomCommandsInPerRepoConfig, config.NegativeRefspec, config.RemoteNamedStar, conflicts.Filter, conflicts.MergeFileBoth, conflicts.MergeFileCurrent, conflicts.MergeFileIncoming, conflicts.ResolveExternally, conflicts.ResolveMultipleFiles, conflicts.ResolveNoAutoStage, conflicts.ResolveNonTextualConflicts, conflicts.ResolveWithoutTrailingLf, conflicts.UndoChooseHunk, custom_commands.AccessCommitProperties, custom_commands.BasicCommand, custom_commands.CheckForConflicts, custom_commands.CustomCommandsSubmenu, custom_commands.CustomCommandsSubmenuWithSpecialKeybindings, custom_commands.FormPrompts, custom_commands.GlobalContext, custom_commands.MenuFromCommand, custom_commands.MenuFromCommandsOutput, custom_commands.MenuPromptWithKeys, custom_commands.MultipleContexts, custom_commands.MultiplePrompts, custom_commands.RunCommand, custom_commands.SelectedCommit, custom_commands.SelectedCommitRange, custom_commands.SelectedPath, custom_commands.SelectedSubmodule, custom_commands.ShowOutputInPanel, custom_commands.SuggestionsCommand, custom_commands.SuggestionsPreset, demo.AmendOldCommit, demo.Bisect, demo.CherryPick, demo.CommitAndPush, demo.CommitGraph, demo.CustomCommand, demo.CustomPatch, demo.DiffCommits, demo.Filter, demo.InteractiveRebase, demo.NukeWorkingTree, demo.RebaseOnto, demo.StageLines, demo.Undo, demo.WorktreeCreateFromBranches, diff.CopyToClipboard, diff.Diff, diff.DiffAndApplyPatch, diff.DiffCommits, diff.DiffNonStickyRange, diff.IgnoreWhitespace, diff.RenameSimilarityThresholdChange, file.CollapseExpand, file.CopyMenu, file.DirWithUntrackedFile, file.DiscardAllDirChanges, file.DiscardRangeSelect, file.DiscardStagedChanges, file.DiscardUnstagedDirChanges, file.DiscardUnstagedFileChanges, file.DiscardUnstagedRangeSelect, file.DiscardVariousChanges, file.DiscardVariousChangesRangeSelect, file.Gitignore, file.GitignoreSpecialCharacters, file.RememberCommitMessageAfterFail, file.RenameSimilarityThresholdChange, file.RenamedFiles, file.RenamedFilesNoRootItem, file.StageChildrenRangeSelect, file.StageDeletedRangeSelect, file.StageRangeSelect, filter_and_search.FilterByFileStatus, filter_and_search.FilterCommitFiles, filter_and_search.FilterFiles, filter_and_search.FilterFuzzy, filter_and_search.FilterMenu, filter_and_search.FilterMenuByKeybinding, filter_and_search.FilterMenuCancelFilterWithEscape, filter_and_search.FilterMenuWithNoKeybindings, filter_and_search.FilterRemoteBranches, filter_and_search.FilterRemotes, filter_and_search.FilterSearchHistory, filter_and_search.FilterUpdatesWhenModelChanges, filter_and_search.NestedFilter, filter_and_search.NestedFilterTransient, filter_and_search.NewSearch, filter_and_search.StageAllStagesOnlyTrackedFilesInTrackedOnlyFilter, filter_and_search.StagingFolderStagesOnlyTrackedFilesInTrackedOnlyFilter, filter_by_author.SelectAuthor, filter_by_author.TypeAuthor, filter_by_path.CliArg, filter_by_path.DropCommitInFilteringMode, filter_by_path.KeepSameCommitSelectedOnExit, filter_by_path.RewordCommitInFilteringMode, filter_by_path.SelectFile, filter_by_path.SelectFilteredFileWhenEnteringCommit, filter_by_path.SelectFilteredFileWhenEnteringCommitNoRootItem, filter_by_path.ShowDiffsForRenamedFile, filter_by_path.TypeFile, interactive_rebase.AdvancedInteractiveRebase, interactive_rebase.AmendCommitWithConflict, interactive_rebase.AmendFirstCommit, interactive_rebase.AmendFixupCommit, interactive_rebase.AmendHeadCommitDuringRebase, interactive_rebase.AmendMerge, interactive_rebase.AmendNonHeadCommitDuringRebase, interactive_rebase.DeleteUpdateRefTodo, interactive_rebase.DontShowBranchHeadsForTodoItems, interactive_rebase.DropCommitInCopiedBranchWithUpdateRef, interactive_rebase.DropMergeCommit, interactive_rebase.DropTodoCommitWithUpdateRef, interactive_rebase.DropWithCustomCommentChar, interactive_rebase.EditAndAutoAmend, interactive_rebase.EditFirstCommit, interactive_rebase.EditLastCommitOfStackedBranch, interactive_rebase.EditNonTodoCommitDuringRebase, interactive_rebase.EditRangeSelectDownToMergeOutsideRebase, interactive_rebase.EditRangeSelectOutsideRebase, interactive_rebase.EditTheConflCommit, interactive_rebase.FixupFirstCommit, interactive_rebase.FixupSecondCommit, interactive_rebase.InteractiveRebaseOfCopiedBranch, interactive_rebase.InteractiveRebaseWithConflictForEditCommand, interactive_rebase.MidRebaseRangeSelect, interactive_rebase.Move, interactive_rebase.MoveAcrossBranchBoundaryOutsideRebase, interactive_rebase.MoveInRebase, interactive_rebase.MoveUpdateRefTodo, interactive_rebase.MoveWithCustomCommentChar, interactive_rebase.OutsideRebaseRangeSelect, interactive_rebase.PickRescheduled, interactive_rebase.QuickStart, interactive_rebase.QuickStartKeepSelection, interactive_rebase.QuickStartKeepSelectionRange, interactive_rebase.Rebase, interactive_rebase.RebaseWithCommitThatBecomesEmpty, interactive_rebase.RevertDuringRebaseWhenStoppedOnEdit, interactive_rebase.RevertMultipleCommitsInInteractiveRebase, interactive_rebase.RevertSingleCommitInInteractiveRebase, interactive_rebase.RewordCommitWithEditorAndFail, interactive_rebase.RewordFirstCommit, interactive_rebase.RewordLastCommit, interactive_rebase.RewordLastCommitOfStackedBranch, interactive_rebase.RewordMergeCommit, interactive_rebase.RewordYouAreHereCommit, interactive_rebase.RewordYouAreHereCommitWithEditor, interactive_rebase.ShowExecTodos, interactive_rebase.SquashDownFirstCommit, interactive_rebase.SquashDownSecondCommit, interactive_rebase.SquashFixupsAbove, interactive_rebase.SquashFixupsAboveFirstCommit, interactive_rebase.SquashFixupsInCurrentBranch, interactive_rebase.SwapInRebaseWithConflict, interactive_rebase.SwapInRebaseWithConflictAndEdit, interactive_rebase.SwapWithConflict, interactive_rebase.ViewFilesOfTodoEntries, misc.ConfirmOnQuit, misc.CopyConfirmationMessageToClipboard, misc.CopyToClipboard, misc.DisabledKeybindings, misc.InitialOpen, misc.RecentReposOnLaunch, patch_building.Apply, patch_building.ApplyInReverse, patch_building.ApplyInReverseWithConflict, patch_building.ApplyWithModifiedFileConflict, patch_building.ApplyWithModifiedFileNoConflict, patch_building.EditLineInPatchBuildingPanel, patch_building.MoveRangeToIndex, patch_building.MoveToEarlierCommit, patch_building.MoveToEarlierCommitFromAddedFile, patch_building.MoveToIndex, patch_building.MoveToIndexFromAddedFileWithConflict, patch_building.MoveToIndexPartOfAdjacentAddedLines, patch_building.MoveToIndexPartial, patch_building.MoveToIndexWithConflict, patch_building.MoveToIndexWithModifiedFile, patch_building.MoveToIndexWorksEvenIfNoprefixIsSet, patch_building.MoveToLaterCommit, patch_building.MoveToLaterCommitPartialHunk, patch_building.MoveToNewCommit, patch_building.MoveToNewCommitBefore, patch_building.MoveToNewCommitFromAddedFile, patch_building.MoveToNewCommitFromDeletedFile, patch_building.MoveToNewCommitInLastCommitOfStackedBranch, patch_building.MoveToNewCommitPartialHunk, patch_building.RemoveFromCommit, patch_building.RemovePartsOfAddedFile, patch_building.ResetWithEscape, patch_building.SelectAllFiles, patch_building.SpecificSelection, patch_building.StartNewPatch, patch_building.ToggleRange, reflog.Checkout, reflog.CherryPick, reflog.DoNotShowBranchMarkersInReflogSubcommits, reflog.Patch, reflog.Reset, remote.AddForkRemote, shell_commands.BasicShellCommand, shell_commands.ComplexShellCommand, shell_commands.DeleteFromHistory, shell_commands.EditHistory, shell_commands.History, shell_commands.OmitFromHistory, staging.DiffChangeScreenMode, staging.DiffContextChange, staging.DiscardAllChanges, staging.Search, staging.StageHunks, staging.StageLines, staging.StageRanges, stash.Apply, stash.ApplyPatch, stash.CreateBranch, stash.Drop, stash.DropMultiple, stash.DropMultipleInFilteredMode, stash.FilterByPath, stash.Pop, stash.PreventDiscardingFileChanges, stash.Rename, stash.ShowWithBranchNamedStash, stash.Stash, stash.StashAll, stash.StashAndKeepIndex, stash.StashIncludingUntrackedFiles, stash.StashStaged, stash.StashStagedPartialFile, stash.StashUnstaged, status.ClickRepoNameToOpenReposMenu, status.ClickToFocus, status.ClickWorkingTreeStateToOpenRebaseOptionsMenu, status.LogCmd, status.LogCmdStatusPanelAllBranchesLog, submodule.Add, submodule.Enter, submodule.EnterNested, submodule.Remove, submodule.RemoveNested, submodule.Reset, submodule.ResetFolder, sync.FetchAndAutoForwardBranchesAllBranches, sync.FetchAndAutoForwardBranchesAllBranchesCheckedOutInOtherWorktree, sync.FetchAndAutoForwardBranchesNone, sync.FetchAndAutoForwardBranchesOnlyMainBranches, sync.FetchPrune, sync.FetchWhenSortedByDate, sync.ForcePush, sync.ForcePushMultipleMatching, sync.ForcePushMultipleUpstream, sync.ForcePushRemoteBranchNotStoredLocally, sync.ForcePushTriangular, sync.Pull, sync.PullAndSetUpstream, sync.PullMerge, sync.PullMergeConflict, sync.PullRebase, sync.PullRebaseConflict, sync.PullRebaseInteractiveConflict, sync.PullRebaseInteractiveConflictDrop, sync.Push, sync.PushAndAutoSetUpstream, sync.PushAndSetUpstream, sync.PushFollowTags, sync.PushNoFollowTags, sync.PushTag, sync.PushWithCredentialPrompt, sync.RenameBranchAndPull, tag.Checkout, tag.CheckoutWhenBranchWithSameNameExists, tag.CopyToClipboard, tag.CreateWhileCommitting, tag.CrudAnnotated, tag.CrudLightweight, tag.DeleteLocalAndRemote, tag.DeleteRemoteTagWhenBranchWithSameNameExists, tag.ForceTagAnnotated, tag.ForceTagLightweight, tag.Reset, tag.ResetToDuplicateNamedBranch, ui.Accordion, ui.DisableSwitchTabWithPanelJumpKeys, ui.EmptyMenu, ui.KeybindingSuggestionsWhenSwitchingRepos, ui.ModeSpecificKeybindingSuggestions, ui.OpenLinkFailure, ui.RangeSelect, ui.SwitchTabFromMenu, ui.SwitchTabWithPanelJumpKeys, undo.UndoCheckoutAndDrop, undo.UndoCommit, undo.UndoDrop, worktree.AddFromBranch, worktree.AddFromBranchDetached, worktree.AddFromCommit, worktree.AssociateBranchBisect, worktree.AssociateBranchRebase, worktree.BareRepo, worktree.BareRepoWorktreeConfig, worktree.Crud, worktree.CustomCommand, worktree.DetachWorktreeFromBranch, worktree.DotfileBareRepo, worktree.DoubleNestedLinkedSubmodule, worktree.ExcludeFileInWorktree, worktree.FastForwardWorktreeBranch, worktree.FastForwardWorktreeBranchShouldNotPolluteCurrentWorktree, worktree.ForceRemoveWorktree, worktree.ForceRemoveWorktreeWithSubmodules, worktree.RemoveWorktreeFromBranch, worktree.ResetWindowTabs, worktree.SymlinkIntoRepoSubdir, worktree.WorktreeInRepo, }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/misc/disabled_keybindings.go
pkg/integration/tests/misc/disabled_keybindings.go
package misc import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DisabledKeybindings = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Confirms you can disable keybindings by setting them to <disabled>", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Keybinding.Universal.PrevItem = "<disabled>" config.GetUserConfig().Keybinding.Universal.NextItem = "<disabled>" config.GetUserConfig().Keybinding.Universal.NextTab = "<up>" config.GetUserConfig().Keybinding.Universal.PrevTab = "<down>" }, SetupRepo: func(shell *Shell) {}, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Press("<up>") t.Views().Worktrees().IsFocused() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/misc/confirm_on_quit.go
pkg/integration/tests/misc/confirm_on_quit.go
package misc import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var ConfirmOnQuit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Quitting with a confirm prompt", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().ConfirmOnQuit = true }, SetupRepo: func(shell *Shell) {}, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Press(keys.Universal.Quit) t.ExpectPopup().Confirmation(). Title(Equals("")). Content(Contains("Are you sure you want to quit?")). Confirm() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/misc/initial_open.go
pkg/integration/tests/misc/initial_open.go
package misc import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var InitialOpen = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Confirms a popup appears on first opening Lazygit", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().DisableStartupPopups = false }, SetupRepo: func(shell *Shell) {}, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.ExpectPopup().Confirmation(). Title(Equals("")). Content(Contains("Thanks for using lazygit!")). Confirm() t.Views().Files().IsFocused() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/misc/copy_confirmation_message_to_clipboard.go
pkg/integration/tests/misc/copy_confirmation_message_to_clipboard.go
package misc import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var CopyConfirmationMessageToClipboard = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Copy the text of a confirmation popup to the clipboard", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > clipboard" }, SetupRepo: func(shell *Shell) { shell.EmptyCommit("commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit").IsSelected(), ). Press(keys.Universal.Remove) t.ExpectPopup().Alert(). Title(Equals("Drop commit")). Content(Equals("Are you sure you want to drop the selected commit(s)?")). Tap(func() { t.GlobalPress(keys.Universal.CopyToClipboard) t.ExpectToast(Equals("Message copied to clipboard")) }). Confirm() t.FileSystem().FileContent("clipboard", Equals("Are you sure you want to drop the selected commit(s)?")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/misc/recent_repos_on_launch.go
pkg/integration/tests/misc/recent_repos_on_launch.go
package misc import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) // Couldn't find an easy way to actually reproduce the situation of opening outside a repo, // so I'm introducing a hacky env var to force lazygit to show the recent repos menu upon opening. var RecentReposOnLaunch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "When opening to a menu, focus is correctly given to the menu", ExtraCmdArgs: []string{}, ExtraEnvVars: map[string]string{ "SHOW_RECENT_REPOS": "true", }, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) {}, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.ExpectPopup().Menu(). Title(Equals("Recent repositories")). Select(Contains("Cancel")). Confirm() t.Views().Files().IsFocused() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/misc/copy_to_clipboard.go
pkg/integration/tests/misc/copy_to_clipboard.go
package misc import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) // We're emulating the clipboard by writing to a file called clipboard var CopyToClipboard = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Copy a branch name to the clipboard using custom clipboard command template", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > clipboard" }, SetupRepo: func(shell *Shell) { shell.NewBranch("branch-a") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( Contains("branch-a").IsSelected(), ). Press(keys.Universal.CopyToClipboard) t.ExpectToast(Equals("'branch-a' copied to clipboard")) t.FileSystem().FileContent("clipboard", Equals("branch-a")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/reflog/reset.go
pkg/integration/tests/reflog/reset.go
package reflog import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var Reset = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Hard reset to a reflog commit", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("one") shell.EmptyCommit("two") shell.EmptyCommit("three") shell.HardReset("HEAD^^") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().ReflogCommits(). Focus(). Lines( Contains("reset: moving to HEAD^^").IsSelected(), Contains("commit: three"), Contains("commit: two"), Contains("commit (initial): one"), ). SelectNextItem(). Press(keys.Commits.ViewResetOptions). Tap(func() { t.ExpectPopup().Menu(). Title(Contains("Reset to")). Select(Contains("Hard reset")). Confirm() }). TopLines( Contains("reset: moving to").IsSelected(), Contains("reset: moving to HEAD^^"), ) t.Views().Commits(). Focus(). Lines( Contains("three").IsSelected(), Contains("two"), Contains("one"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/reflog/checkout.go
pkg/integration/tests/reflog/checkout.go
package reflog import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var Checkout = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Checkout a reflog commit as a detached head", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("one") shell.EmptyCommit("two") shell.EmptyCommit("three") shell.HardReset("HEAD^^") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().ReflogCommits(). Focus(). Lines( Contains("reset: moving to HEAD^^").IsSelected(), Contains("commit: three"), Contains("commit: two"), Contains("commit (initial): one"), ). SelectNextItem(). PressPrimaryAction(). Tap(func() { t.ExpectPopup().Menu(). Title(Contains("Checkout branch or commit")). Select(MatchesRegexp("Checkout commit [a-f0-9]+ as detached head")). Confirm() }). TopLines( Contains("checkout: moving from master to").IsSelected(), Contains("reset: moving to HEAD^^"), ) t.Views().Branches(). Lines( Contains("(HEAD detached at").IsSelected(), Contains("master"), ) t.Views().Commits(). Focus(). Lines( Contains("three").IsSelected(), Contains("two"), Contains("one"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/reflog/cherry_pick.go
pkg/integration/tests/reflog/cherry_pick.go
package reflog import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Cherry pick a reflog commit", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("one") shell.EmptyCommit("two") shell.EmptyCommit("three") shell.HardReset("HEAD^^") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().ReflogCommits(). Focus(). Lines( Contains("reset: moving to HEAD^^").IsSelected(), Contains("commit: three"), Contains("commit: two"), Contains("commit (initial): one"), ). SelectNextItem(). Press(keys.Commits.CherryPickCopy) t.Views().Information().Content(Contains("1 commit copied")) t.Views().Commits(). Focus(). Lines( Contains("one").IsSelected(), ). Press(keys.Commits.PasteCommits). Tap(func() { t.ExpectPopup().Alert(). Title(Equals("Cherry-pick")). Content(Contains("Are you sure you want to cherry-pick the 1 copied commit(s) onto this branch?")). Confirm() }). Lines( Contains("three"), Contains("one").IsSelected(), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/reflog/patch.go
pkg/integration/tests/reflog/patch.go
package reflog import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var Patch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Build a patch from a reflog commit and apply it", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("one") shell.EmptyCommit("two") shell.CreateFileAndAdd("file1", "content1") shell.CreateFileAndAdd("file2", "content2") shell.Commit("three") shell.HardReset("HEAD^^") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().ReflogCommits(). Focus(). Lines( Contains("reset: moving to HEAD^^").IsSelected(), Contains("commit: three"), Contains("commit: two"), Contains("commit (initial): one"), ). SelectNextItem(). Lines( Contains("reset: moving to HEAD^^"), Contains("commit: three").IsSelected(), Contains("commit: two"), Contains("commit (initial): one"), ). PressEnter() t.Views().SubCommits(). IsFocused(). Lines( Contains("three").IsSelected(), Contains("two"), Contains("one"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Contains("file1"), Contains("file2"), ). SelectNextItem(). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) t.Views(). CommitFiles(). Press(keys.Universal.CreatePatchOptionsMenu) t.ExpectPopup().Menu(). Title(Equals("Patch options")). Select(MatchesRegexp(`Apply patch$`)).Confirm() t.Views().Files().Lines( Contains("file1"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/reflog/do_not_show_branch_markers_in_reflog_subcommits.go
pkg/integration/tests/reflog/do_not_show_branch_markers_in_reflog_subcommits.go
package reflog import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DoNotShowBranchMarkersInReflogSubcommits = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Verify that no branch heads are shown in the subcommits view of a reflog entry", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.Log.ShowGraph = "never" }, SetupRepo: func(shell *Shell) { shell.NewBranch("branch1") shell.EmptyCommit("one") shell.EmptyCommit("two") shell.NewBranch("branch2") shell.EmptyCommit("three") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { // Check that the local commits view does show a branch marker for branch1 t.Views().Commits(). Lines( Contains("CI three"), Contains("CI * two"), Contains("CI one"), ) t.Views().Branches(). Focus(). // Check out branch1 NavigateToLine(Contains("branch1")). PressPrimaryAction(). // Look at the subcommits of branch2 NavigateToLine(Contains("branch2")). PressEnter(). // Check that we see a marker for branch1 here (but not for // branch2), even though branch1 is checked out Tap(func() { t.Views().SubCommits(). IsFocused(). Lines( Contains("CI three"), Contains("CI * two"), Contains("CI one"), ). PressEscape() }). // Check out branch2 again NavigateToLine(Contains("branch2")). PressPrimaryAction() t.Views().ReflogCommits(). Focus(). TopLines( Contains("checkout: moving from branch1 to branch2").IsSelected(), ). PressEnter(). // Check that the subcommits view for a reflog entry doesn't show // any branch markers Tap(func() { t.Views().SubCommits(). IsFocused(). Lines( Contains("CI three"), Contains("CI two"), Contains("CI one"), ) }) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/apply_with_modified_file_no_conflict.go
pkg/integration/tests/patch_building/apply_with_modified_file_no_conflict.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var ApplyWithModifiedFileNoConflict = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Apply a custom patch, with a modified file in the working tree that does not conflict with the patch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.NewBranch("branch-a") shell.CreateFileAndAdd("file1", "1\n2\n3\n") shell.Commit("first commit") shell.NewBranch("branch-b") shell.UpdateFileAndAdd("file1", "1\n2\n3\n4\n") shell.Commit("update") shell.Checkout("branch-a") shell.UpdateFile("file1", "11\n2\n3\n") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( Contains("branch-a").IsSelected(), Contains("branch-b"), ). Press(keys.Universal.NextItem). PressEnter() t.Views().SubCommits(). IsFocused(). Lines( Contains("update").IsSelected(), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Equals("M file1").IsSelected(), ). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) t.Views().Secondary().Content(Contains("3\n+4")) t.Common().SelectPatchOption(MatchesRegexp(`Apply patch$`)) t.ExpectPopup().Confirmation().Title(Equals("Must stage files")). Content(Contains("Applying a patch to the index requires staging the unstaged files that are affected by the patch.")). Confirm() t.Views().Files(). Focus(). Lines( Equals("M file1").IsSelected(), ) t.Views().Main(). Content(Contains("-1\n+11\n 2\n 3\n+4")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/start_new_patch.go
pkg/integration/tests/patch_building/start_new_patch.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var StartNewPatch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Attempt to add a file from another commit to a patch, then agree to start a new patch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "file1 content") shell.Commit("first commit") shell.CreateFileAndAdd("file2", "file2 content") shell.Commit("second commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("second commit").IsSelected(), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file2").IsSelected(), ). PressPrimaryAction(). Tap(func() { t.Views().Information().Content(Contains("Building patch")) t.Views().Secondary().Content(Contains("file2")) }). PressEscape() t.Views().Commits(). IsFocused(). NavigateToLine(Contains("first commit")). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressPrimaryAction(). Tap(func() { t.ExpectPopup().Confirmation(). Title(Contains("Discard patch")). Content(Contains("You can only build a patch from one commit/stash-entry at a time. Discard current patch?")). Confirm() t.Views().Secondary().Content(Contains("file1").DoesNotContain("file2")) }) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/move_to_new_commit_from_deleted_file.go
pkg/integration/tests/patch_building/move_to_new_commit_from_deleted_file.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveToNewCommitFromDeletedFile = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a file that was deleted in a commit to a new commit", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "1st line\n2nd line\n3rd line\n") shell.Commit("first commit") shell.DeleteFileAndAdd("file1") shell.Commit("commit to move from") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit to move from").IsSelected(), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("D file1").IsSelected(), ). PressEnter() t.Views().PatchBuilding(). IsFocused(). SelectNextItem(). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) t.Common().SelectPatchOption(Contains("Move patch into new commit after the original commit")) t.ExpectPopup().CommitMessagePanel(). InitialText(Equals("")). Type("new commit").Confirm() t.Views().Commits(). IsFocused(). Lines( Contains("new commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("D file1").IsSelected(), ). Tap(func() { t.Views().Main().ContainsLines( Equals("-2nd line"), ) }). PressEscape() t.Views().Commits(). IsFocused(). NavigateToLine(Contains("commit to move from")). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( // In the original commit the file is no longer deleted, but modified Contains("M file1").IsSelected(), ). Tap(func() { t.Views().Main().ContainsLines( Equals("-1st line"), Equals(" 2nd line"), Equals("-3rd line"), ) }) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/move_to_index_from_added_file_with_conflict.go
pkg/integration/tests/patch_building/move_to_index_from_added_file_with_conflict.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveToIndexFromAddedFileWithConflict = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a file that was added in a commit to the index, causing a conflict", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("first commit") shell.CreateFileAndAdd("file1", "1st line\n2nd line\n3rd line\n") shell.Commit("commit to move from") shell.UpdateFileAndAdd("file1", "1st line\n2nd line changed\n3rd line\n") shell.Commit("conflicting change") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("conflicting change").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressEnter() t.Views().PatchBuilding(). IsFocused(). SelectNextItem(). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) t.Common().SelectPatchOption(Contains("Move patch out into index")) t.Common().AcknowledgeConflicts() t.Views().Files(). IsFocused(). Lines( Contains("UU").Contains("file1"), ). PressEnter() t.Views().MergeConflicts(). IsFocused(). ContainsLines( Contains("1st line"), Contains("<<<<<<< HEAD"), Contains("======="), Contains("2nd line changed"), Contains(">>>>>>>"), Contains("3rd line"), ). SelectNextItem(). PressPrimaryAction() t.Common().ContinueOnConflictsResolved("rebase") t.ExpectPopup().Alert(). Title(Equals("Error")). Content(Contains("Applied patch to 'file1' with conflicts")). Confirm() t.Views().Files(). IsFocused(). Lines( Contains("UU").Contains("file1"), ). PressEnter() t.Views().MergeConflicts(). TopLines( Contains("1st line"), Contains("<<<<<<< ours"), Contains("2nd line changed"), Contains("======="), Contains("2nd line"), Contains(">>>>>>> theirs"), Contains("3rd line"), ). IsFocused() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/move_to_new_commit_before.go
pkg/integration/tests/patch_building/move_to_new_commit_before.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveToNewCommitBefore = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to a new commit before the original one", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateDir("dir") shell.CreateFileAndAdd("dir/file1", "file1 content") shell.CreateFileAndAdd("dir/file2", "file2 content") shell.Commit("first commit") shell.UpdateFileAndAdd("dir/file1", "file1 content with old changes") shell.DeleteFileAndAdd("dir/file2") shell.CreateFileAndAdd("dir/file3", "file3 content") shell.Commit("commit to move from") shell.UpdateFileAndAdd("dir/file1", "file1 content with new changes") shell.Commit("third commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("third commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("dir").IsSelected(), Contains(" M file1"), Contains(" D file2"), Contains(" A file3"), ). PressPrimaryAction(). PressEscape() t.Views().Information().Content(Contains("Building patch")) t.Common().SelectPatchOption(Contains("Move patch into new commit before the original commit")) t.ExpectPopup().CommitMessagePanel(). InitialText(Equals("")). Type("new commit").Confirm() t.Views().Commits(). IsFocused(). Lines( Contains("third commit"), Contains("commit to move from").IsSelected(), Contains("new commit"), Contains("first commit"), ). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("dir").IsSelected(), Contains(" M file1"), Contains(" D file2"), Contains(" A file3"), ). PressEscape() t.Views().Commits(). IsFocused(). SelectPreviousItem(). PressEnter() // the original commit has no more files in it t.Views().CommitFiles(). IsFocused(). Lines( Contains("(none)"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/apply.go
pkg/integration/tests/patch_building/apply.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var Apply = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Apply a custom patch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.NewBranch("branch-a") shell.CreateFileAndAdd("file1", "first line\n") shell.Commit("first commit") shell.NewBranch("branch-b") shell.UpdateFileAndAdd("file1", "first line\nsecond line\n") shell.Commit("update") shell.Checkout("branch-a") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( Contains("branch-a").IsSelected(), Contains("branch-b"), ). Press(keys.Universal.NextItem). PressEnter() t.Views().SubCommits(). IsFocused(). Lines( Contains("update").IsSelected(), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("M file1").IsSelected(), ). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) t.Views().Secondary().Content(Contains("second line")) t.Common().SelectPatchOption(MatchesRegexp(`Apply patch$`)) t.Views().Files(). Focus(). Lines( Contains("file1").IsSelected(), ) t.Views().Main(). Content(Contains("second line")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/move_range_to_index.go
pkg/integration/tests/patch_building/move_range_to_index.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveRangeToIndex = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Apply a custom patch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "first line\n") shell.Commit("first commit") shell.UpdateFileAndAdd("file1", "first line\nsecond line\n") shell.CreateFileAndAdd("file2", "file two content\n") shell.CreateFileAndAdd("file3", "file three content\n") shell.Commit("second commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("second commit").IsSelected(), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Equals(" M file1"), Equals(" A file2"), Equals(" A file3"), ). SelectNextItem(). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("file2")). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) t.Views().Secondary().Content(Contains("second line")) t.Views().Secondary().Content(Contains("file two content")) t.Common().SelectPatchOption(MatchesRegexp(`Move patch out into index$`)) t.Views().CommitFiles(). IsFocused(). Lines( Contains("file3").IsSelected(), ).PressEscape() t.Views().Files(). Focus(). Lines( Equals("β–Ό /").IsSelected(), Equals(" M file1"), Equals(" A file2"), ) t.Views().Main(). Content(Contains("second line")) t.Views().Files().Focus().NavigateToLine(Contains("file2")) t.Views().Main(). Content(Contains("file two content")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/edit_line_in_patch_building_panel.go
pkg/integration/tests/patch_building/edit_line_in_patch_building_panel.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var EditLineInPatchBuildingPanel = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Edit a line in the patch building panel; make sure we end up on the right line", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().OS.EditAtLine = "echo {{filename}}:{{line}} > edit-command" }, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file.txt", "4\n5\n6\n") shell.Commit("01") shell.UpdateFileAndAdd("file.txt", "1\n2a\n2b\n3\n4\n5\n6\n") shell.Commit("02") shell.UpdateFile("file.txt", "1\n2\n3\n4\n5\n6\n") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("02").IsSelected(), Contains("01"), ). Press(keys.Universal.NextItem). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("A file.txt").IsSelected(), ). PressEnter() t.Views().PatchBuilding(). IsFocused(). Content(Contains("+4\n+5\n+6")). NavigateToLine(Contains("+5")). Press(keys.Universal.Edit) t.FileSystem().FileContent("edit-command", Contains("file.txt:5\n")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/move_to_new_commit_partial_hunk.go
pkg/integration/tests/patch_building/move_to_new_commit_partial_hunk.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveToNewCommitPartialHunk = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to a new commit, with only parts of a hunk in the patch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "") shell.Commit("first commit") shell.UpdateFileAndAdd("file1", "1st line\n2nd line\n") shell.Commit("commit to move from") shell.UpdateFileAndAdd("file1", "1st line\n2nd line\n3rd line\n") shell.Commit("third commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("third commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressEnter() t.Views().PatchBuilding(). IsFocused(). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) t.Common().SelectPatchOption(Contains("Move patch into new commit after the original commit")) t.ExpectPopup().CommitMessagePanel(). InitialText(Equals("")). Type("new commit").Confirm() t.Views().Commits(). IsFocused(). Lines( Contains("third commit"), Contains("new commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). Tap(func() { t.Views().Main(). Content(Contains("+1st line\n 2nd line")) }). PressEscape() t.Views().Commits(). IsFocused(). Lines( Contains("third commit"), Contains("new commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). Tap(func() { t.Views().Main(). Content(Contains("+2nd line"). DoesNotContain("1st line")) }) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/remove_parts_of_added_file.go
pkg/integration/tests/patch_building/remove_parts_of_added_file.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RemovePartsOfAddedFile = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Remove a custom patch from a file that was added in a commit", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("first commit") shell.CreateFileAndAdd("file1", "1st line\n2nd line\n3rd line\n") shell.Commit("commit to remove from") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit to remove from").IsSelected(), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("A file1").IsSelected(), ). PressEnter() t.Views().PatchBuilding(). IsFocused(). SelectNextItem(). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) t.Common().SelectPatchOption(Contains("Remove patch from original commit")) t.Views().CommitFiles(). IsFocused(). Lines( Contains("A file1").IsSelected(), ). PressEscape() t.Views().Main().ContainsLines( Equals("+1st line"), Equals("+3rd line"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/move_to_new_commit.go
pkg/integration/tests/patch_building/move_to_new_commit.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveToNewCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to a new commit", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateDir("dir") shell.CreateFileAndAdd("dir/file1", "file1 content") shell.CreateFileAndAdd("dir/file2", "file2 content") shell.Commit("first commit") shell.UpdateFileAndAdd("dir/file1", "file1 content with old changes") shell.DeleteFileAndAdd("dir/file2") shell.CreateFileAndAdd("dir/file3", "file3 content") shell.Commit("commit to move from") shell.UpdateFileAndAdd("dir/file1", "file1 content with new changes") shell.Commit("third commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("third commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("dir").IsSelected(), Contains(" M file1"), Contains(" D file2"), Contains(" A file3"), ). PressPrimaryAction(). PressEscape() t.Views().Information().Content(Contains("Building patch")) t.Common().SelectPatchOption(Contains("Move patch into new commit after the original commit")) t.ExpectPopup().CommitMessagePanel(). InitialText(Equals("")). Type("new commit").Confirm() t.Views().Commits(). IsFocused(). Lines( Contains("third commit"), Contains("new commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("dir").IsSelected(), Contains(" M file1"), Contains(" D file2"), Contains(" A file3"), ). PressEscape() t.Views().Commits(). IsFocused(). Lines( Contains("third commit"), Contains("new commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). SelectNextItem(). PressEnter() // the original commit has no more files in it t.Views().CommitFiles(). IsFocused(). Lines( Contains("(none)"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/remove_from_commit.go
pkg/integration/tests/patch_building/remove_from_commit.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RemoveFromCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Remove a custom patch from a commit", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "file1 content\n") shell.CreateFileAndAdd("file2", "file2 content\n") shell.Commit("first commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("first commit").IsSelected(), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Contains("file1"), Contains("file2"), ). SelectNextItem(). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) t.Views().Secondary().Content(Contains("+file1 content")) t.Common().SelectPatchOption(Contains("Remove patch from original commit")) t.Views().Files().IsEmpty() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file2").IsSelected(), ). PressEscape() t.Views().Main(). Content(Contains("+file2 content")) t.Views().Commits(). Lines( Contains("first commit").IsSelected(), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/apply_with_modified_file_conflict.go
pkg/integration/tests/patch_building/apply_with_modified_file_conflict.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var ApplyWithModifiedFileConflict = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Apply a custom patch, with a modified file in the working tree that conflicts with the patch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.NewBranch("branch-a") shell.CreateFileAndAdd("file1", "1\n2\n3\n") shell.Commit("first commit") shell.NewBranch("branch-b") shell.UpdateFileAndAdd("file1", "11\n2\n3\n") shell.Commit("update") shell.Checkout("branch-a") shell.UpdateFile("file1", "111\n2\n3\n") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( Contains("branch-a").IsSelected(), Contains("branch-b"), ). Press(keys.Universal.NextItem). PressEnter() t.Views().SubCommits(). IsFocused(). Lines( Contains("update").IsSelected(), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Equals("M file1").IsSelected(), ). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) t.Views().Secondary().Content(Contains("-1\n+11\n")) t.Common().SelectPatchOption(MatchesRegexp(`Apply patch$`)) t.ExpectPopup().Confirmation().Title(Equals("Must stage files")). Content(Contains("Applying a patch to the index requires staging the unstaged files that are affected by the patch.")). Confirm() t.ExpectPopup().Alert().Title(Equals("Error")). Content(Contains("Applied patch to 'file1' with conflicts.")). Confirm() t.Views().Files(). Focus(). Lines( Equals("UU file1").IsSelected(), ). PressEnter() t.Views().MergeConflicts(). IsFocused(). Lines( Equals("<<<<<<< ours"), Equals("111"), Equals("======="), Equals("11"), Equals(">>>>>>> theirs"), Equals("2"), Equals("3"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/apply_in_reverse.go
pkg/integration/tests/patch_building/apply_in_reverse.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var ApplyInReverse = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Apply a custom patch in reverse", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "file1 content\n") shell.CreateFileAndAdd("file2", "file2 content\n") shell.Commit("first commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("first commit").IsSelected(), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Equals(" A file1"), Equals(" A file2"), ). SelectNextItem(). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) t.Views().Secondary().Content(Contains("+file1 content")) t.Common().SelectPatchOption(Contains("Apply patch in reverse")) t.Views().Files(). Focus(). Lines( Contains("D").Contains("file1").IsSelected(), ) t.Views().Main(). Content(Contains("-file1 content")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/move_to_index_works_even_if_noprefix_is_set.go
pkg/integration/tests/patch_building/move_to_index_works_even_if_noprefix_is_set.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveToIndexWorksEvenIfNoprefixIsSet = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Moving a patch to the index works even if diff.noprefix or diff.external are set", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "file1 content\n") shell.Commit("first commit") // Test that this works even if custom diff options are set shell.SetConfig("diff.noprefix", "true") shell.SetConfig("diff.external", "echo") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("first commit").IsSelected(), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressPrimaryAction() t.Views().Secondary().Content(Contains("+file1 content")) t.Common().SelectPatchOption(Contains("Move patch out into index")) t.Views().CommitFiles().IsFocused(). Lines( Equals("(none)"), ) t.Views().Files(). Lines( Contains("A").Contains("file1"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/move_to_new_commit_in_last_commit_of_stacked_branch.go
pkg/integration/tests/patch_building/move_to_new_commit_in_last_commit_of_stacked_branch.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveToNewCommitInLastCommitOfStackedBranch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to a new commit, in the last commit of a branch in the middle of a stack", ExtraCmdArgs: []string{}, Skip: false, GitVersion: AtLeast("2.38.0"), SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.Log.ShowGraph = "never" }, SetupRepo: func(shell *Shell) { shell. EmptyCommit("commit 01"). NewBranch("branch1"). EmptyCommit("commit 02"). CreateFileAndAdd("file1", "file1 content"). CreateFileAndAdd("file2", "file2 content"). Commit("commit 03"). NewBranch("branch2"). CreateNCommitsStartingAt(2, 4) shell.SetConfig("rebase.updateRefs", "true") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("CI commit 05").IsSelected(), Contains("CI commit 04"), Contains("CI * commit 03"), Contains("CI commit 02"), Contains("CI commit 01"), ). NavigateToLine(Contains("commit 03")). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Equals(" A file1"), Equals(" A file2"), ). SelectNextItem(). PressPrimaryAction(). PressEscape() t.Views().Information().Content(Contains("Building patch")) t.Common().SelectPatchOption(Contains("Move patch into new commit after the original commit")) t.ExpectPopup().CommitMessagePanel(). InitialText(Equals("")). Type("new commit").Confirm() t.Views().Commits(). IsFocused(). Lines( Contains("CI commit 05"), Contains("CI commit 04"), Contains("CI * new commit").IsSelected(), Contains("CI commit 03"), Contains("CI commit 02"), Contains("CI commit 01"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/specific_selection.go
pkg/integration/tests/patch_building/specific_selection.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var SpecificSelection = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Build a custom patch with a specific selection of lines, adding individual lines, as well as a range and hunk, and adding a file directly", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Gui.UseHunkModeInStagingView = false }, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("hunk-file", "1a\n1b\n1c\n1d\n1e\n1f\n1g\n1h\n1i\n1j\n1k\n1l\n1m\n1n\n1o\n1p\n1q\n1r\n1s\n1t\n1u\n1v\n1w\n1x\n1y\n1z\n") shell.Commit("first commit") // making changes in two separate places for the sake of having two hunks shell.UpdateFileAndAdd("hunk-file", "aa\n1b\ncc\n1d\n1e\n1f\n1g\n1h\n1i\n1j\n1k\n1l\n1m\n1n\n1o\n1p\n1q\n1r\n1s\ntt\nuu\nvv\n1w\n1x\n1y\n1z\n") shell.CreateFileAndAdd("line-file", "2a\n2b\n2c\n2d\n2e\n2f\n2g\n2h\n2i\n2j\n2k\n2l\n2m\n2n\n2o\n2p\n2q\n2r\n2s\n2t\n2u\n2v\n2w\n2x\n2y\n2z\n") shell.CreateFileAndAdd("direct-file", "direct file content") shell.Commit("second commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("second commit").IsSelected(), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Contains("direct-file"), Contains("hunk-file"), Contains("line-file"), ). SelectNextItem(). PressPrimaryAction(). Tap(func() { t.Views().Information().Content(Contains("Building patch")) t.Views().Secondary().Content(Contains("direct file content")) }). NavigateToLine(Contains("hunk-file")). PressEnter() t.Views().PatchBuilding(). IsFocused(). SelectedLines( Contains("-1a"), ). Press(keys.Main.ToggleSelectHunk). SelectedLines( Contains(`-1a`), Contains(`+aa`), ). PressPrimaryAction(). SelectedLines( Contains(`-1c`), Contains(`+cc`), ). Tap(func() { t.Views().Information().Content(Contains("Building patch")) t.Views().Secondary().Content( // when we're inside the patch building panel, we only show the patch // in the secondary panel that relates to the selected file DoesNotContain("direct file content"). Contains("@@ -1,6 +1,6 @@"). Contains(" 1f"), ) }). // Cancel hunk select PressEscape(). // Escape the view PressEscape() t.Views().CommitFiles(). IsFocused(). NavigateToLine(Contains("line-file")). PressEnter() t.Views().PatchBuilding(). IsFocused(). SelectedLines( Contains("+2a"), ). PressPrimaryAction(). SelectedLines( Contains("+2b"), ). NavigateToLine(Contains("+2c")). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("+2e")). PressPrimaryAction(). SelectedLines( Contains("+2f"), ). NavigateToLine(Contains("+2g")). PressPrimaryAction(). SelectedLines( Contains("+2h"), ). Tap(func() { t.Views().Information().Content(Contains("Building patch")) t.Views().Secondary().ContainsLines( Contains("+2a"), Contains("+2c"), Contains("+2d"), Contains("+2e"), Contains("+2g"), ) }). PressEscape(). Tap(func() { t.Views().Secondary().ContainsLines( // direct-file patch Contains(`diff --git a/direct-file b/direct-file`), Contains(`index`), Contains(`--- a/direct-file`), Contains(`+++ b/direct-file`), Contains(`@@ -0,0 +1 @@`), Contains(`+direct file content`), Contains(`\ No newline at end of file`), // hunk-file patch Contains(`diff --git a/hunk-file b/hunk-file`), Contains(`index`), Contains(`--- a/hunk-file`), Contains(`+++ b/hunk-file`), Contains(`@@ -1,6 +1,6 @@`), Contains(`-1a`), Contains(`+aa`), Contains(` 1b`), Contains(` 1c`), Contains(` 1d`), Contains(` 1e`), Contains(` 1f`), // line-file patch Contains(`diff --git a/line-file b/line-file`), Contains(`index`), Contains(`--- a/line-file`), Contains(`+++ b/line-file`), Contains(`@@ -0,0 +1,5 @@`), Contains(`+2a`), Contains(`+2c`), Contains(`+2d`), Contains(`+2e`), Contains(`+2g`), ) }) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/move_to_index.go
pkg/integration/tests/patch_building/move_to_index.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveToIndex = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to the index", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "file1 content\n") shell.CreateFileAndAdd("file2", "file2 content\n") shell.Commit("first commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("first commit").IsSelected(), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Contains("file1"), Contains("file2"), ). SelectNextItem(). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) t.Views().Secondary().Content(Contains("+file1 content")) t.Common().SelectPatchOption(Contains("Move patch out into index")) t.Views().Files(). Lines( Contains("A").Contains("file1"), ) t.Views().CommitFiles(). IsFocused(). Lines( Contains("file2").IsSelected(), ). PressEscape() t.Views().Main(). Content(Contains("+file2 content")) t.Views().Commits(). Lines( Contains("first commit").IsSelected(), ) t.Views().Files(). Focus() t.Views().Main(). Content(Contains("file1 content")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/move_to_earlier_commit_from_added_file.go
pkg/integration/tests/patch_building/move_to_earlier_commit_from_added_file.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveToEarlierCommitFromAddedFile = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a file that was added in a commit to an earlier commit", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("first commit") shell.EmptyCommit("destination commit") shell.CreateFileAndAdd("file1", "1st line\n2nd line\n3rd line\n") shell.Commit("commit to move from") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit to move from").IsSelected(), Contains("destination commit"), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("A file").IsSelected(), ). PressEnter() t.Views().PatchBuilding(). IsFocused(). SelectNextItem(). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) t.Views().Commits(). Focus(). SelectNextItem() t.Common().SelectPatchOption(Contains("Move patch to selected commit")) // This results in a conflict at the commit we're moving from, because // it tries to add a file that already exists t.Common().AcknowledgeConflicts() t.Views().Files(). IsFocused(). Lines( Contains("AA").Contains("file"), ). PressEnter() t.Views().MergeConflicts(). IsFocused(). TopLines( Contains("<<<<<<< HEAD"), Contains("2nd line"), Contains("======="), Contains("1st line"), Contains("2nd line"), Contains("3rd line"), Contains(">>>>>>>"), ). SelectNextItem(). PressPrimaryAction() // choose the version with all three lines t.Common().ContinueOnConflictsResolved("rebase") t.Views().Commits(). Focus(). Lines( Contains("commit to move from"), Contains("destination commit").IsSelected(), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("A file").IsSelected(), ). Tap(func() { t.Views().Main().ContainsLines( Equals("+2nd line"), ) }). PressEscape() t.Views().Commits(). IsFocused(). NavigateToLine(Contains("commit to move from")). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("M file").IsSelected(), ). Tap(func() { t.Views().Main().ContainsLines( Equals("+1st line"), Equals(" 2nd line"), Equals("+3rd line"), ) }) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/select_all_files.go
pkg/integration/tests/patch_building/select_all_files.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var SelectAllFiles = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Add all files of a commit to a custom patch with the 'a' keybinding", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "file1 content") shell.CreateFileAndAdd("file2", "file2 content") shell.CreateFileAndAdd("file3", "file3 content") shell.Commit("first commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("first commit").IsSelected(), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Equals(" A file1"), Equals(" A file2"), Equals(" A file3"), ). Press(keys.Files.ToggleStagedAll) t.Views().Information().Content(Contains("Building patch")) t.Views().Secondary().Content( Contains("file1").Contains("file3").Contains("file3"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/move_to_index_partial.go
pkg/integration/tests/patch_building/move_to_index_partial.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveToIndexPartial = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to the index. This is different from the MoveToIndex test in that we're only selecting a partial patch from a file", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "first line\nsecond line\nthird line\n") shell.Commit("first commit") shell.UpdateFileAndAdd("file1", "first line2\nsecond line\nthird line2\n") shell.Commit("second commit") shell.CreateFileAndAdd("file2", "file1 content") shell.Commit("third commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("third commit").IsSelected(), Contains("second commit"), Contains("first commit"), ). NavigateToLine(Contains("second commit")). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressEnter() t.Views().PatchBuilding(). IsFocused(). ContainsLines( Contains(`-first line`).IsSelected(), Contains(`+first line2`), Contains(` second line`), Contains(`-third line`), Contains(`+third line2`), ). PressPrimaryAction(). Tap(func() { t.Views().Information().Content(Contains("Building patch")) t.Views().Secondary(). ContainsLines( Contains(`-first line`), Contains(`+first line2`), Contains(` second line`), Contains(` third line`), ) t.Common().SelectPatchOption(Contains("Move patch out into index")) t.Views().Files(). Lines( Contains("M").Contains("file1"), ) }) // Focus is automatically returned to the commit files panel. Arguably it shouldn't be. t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1"), ) t.Views().Main(). ContainsLines( Contains(` first line`), Contains(` second line`), Contains(`-third line`), Contains(`+third line2`), ) t.Views().Files(). Focus() t.Views().Main(). ContainsLines( Contains(`-first line`), Contains(`+first line2`), Contains(` second line`), Contains(` third line2`), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/reset_with_escape.go
pkg/integration/tests/patch_building/reset_with_escape.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var ResetWithEscape = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Reset a custom patch with the escape keybinding", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "file1 content") shell.Commit("first commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("first commit").IsSelected(), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressPrimaryAction(). Tap(func() { t.Views().Information().Content(Contains("Building patch")) }). PressEscape() // hitting escape at the top level will reset the patch t.Views().Commits(). IsFocused(). PressEscape() t.Views().Information().Content(DoesNotContain("Building patch")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/move_to_earlier_commit.go
pkg/integration/tests/patch_building/move_to_earlier_commit.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveToEarlierCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to an earlier commit", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateDir("dir") shell.CreateFileAndAdd("dir/file1", "file1 content") shell.CreateFileAndAdd("dir/file2", "file2 content") shell.Commit("first commit") shell.CreateFileAndAdd("unrelated-file", "") shell.Commit("destination commit") shell.UpdateFileAndAdd("dir/file1", "file1 content with old changes") shell.DeleteFileAndAdd("dir/file2") shell.CreateFileAndAdd("dir/file3", "file3 content") shell.Commit("commit to move from") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit to move from").IsSelected(), Contains("destination commit"), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("dir").IsSelected(), Contains(" M file1"), Contains(" D file2"), Contains(" A file3"), ). PressPrimaryAction(). PressEscape() t.Views().Information().Content(Contains("Building patch")) t.Views().Commits(). IsFocused(). SelectNextItem() t.Common().SelectPatchOption(Contains("Move patch to selected commit")) t.Views().Commits(). IsFocused(). Lines( Contains("commit to move from"), Contains("destination commit").IsSelected(), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Equals(" β–Ό dir"), Equals(" M file1"), Equals(" D file2"), Equals(" A file3"), Equals(" A unrelated-file"), ). PressEscape() t.Views().Commits(). IsFocused(). SelectPreviousItem(). PressEnter() // the original commit has no more files in it t.Views().CommitFiles(). IsFocused(). Lines( Contains("(none)"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/toggle_range.go
pkg/integration/tests/patch_building/toggle_range.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var ToggleRange = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Check multi select toggle logic", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateDir("dir1") shell.CreateFileAndAdd("dir1/file1-a", "d2f1 first line\nsecond line\nthird line\n") shell.CreateFileAndAdd("dir1/file2-a", "d1f2 first line\n") shell.CreateFileAndAdd("dir1/file3-a", "d1f3 first line\n") shell.CreateDir("dir2") shell.CreateFileAndAdd("dir2/file1-b", "d2f1 first line\nsecond line\nthird line\n") shell.CreateFileAndAdd("dir2/file2-b", "d2f2 first line\n") shell.CreateFileAndAdd("dir2/file3-b", "d2f3 first line\nsecond line\n") shell.Commit("first commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("first commit").IsSelected(), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Equals(" β–Ό dir1"), Equals(" A file1-a"), Equals(" A file2-a"), Equals(" A file3-a"), Equals(" β–Ό dir2"), Equals(" A file1-b"), Equals(" A file2-b"), Equals(" A file3-b"), ). NavigateToLine(Contains("file1-a")). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("file3-a")). PressPrimaryAction(). Lines( Equals("β–Ό /"), Equals(" β–Ό dir1"), Equals(" ● file1-a").IsSelected(), Equals(" ● file2-a").IsSelected(), Equals(" ● file3-a").IsSelected(), Equals(" β–Ό dir2"), Equals(" A file1-b"), Equals(" A file2-b"), Equals(" A file3-b"), ). PressEscape(). NavigateToLine(Contains("file3-b")). PressEnter() t.Views().Main().IsFocused(). NavigateToLine(Contains("second line")). PressPrimaryAction(). PressEscape() t.Views().CommitFiles(). IsFocused(). Lines( Equals("β–Ό /"), Equals(" β–Ό dir1"), Equals(" ● file1-a"), Equals(" ● file2-a"), Equals(" ● file3-a"), Equals(" β–Ό dir2"), Equals(" A file1-b"), Equals(" A file2-b"), Equals(" ◐ file3-b").IsSelected(), ). NavigateToLine(Contains("dir1")). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("dir2")). PressPrimaryAction(). Lines( Equals("β–Ό /"), Equals(" β–Ό dir1").IsSelected(), Equals(" ● file1-a").IsSelected(), Equals(" ● file2-a").IsSelected(), Equals(" ● file3-a").IsSelected(), Equals(" β–Ό dir2").IsSelected(), Equals(" ● file1-b"), Equals(" ● file2-b"), Equals(" ● file3-b"), ). PressPrimaryAction(). Lines( Equals("β–Ό /"), Equals(" β–Ό dir1").IsSelected(), Equals(" A file1-a").IsSelected(), Equals(" A file2-a").IsSelected(), Equals(" A file3-a").IsSelected(), Equals(" β–Ό dir2").IsSelected(), Equals(" A file1-b"), Equals(" A file2-b"), Equals(" A file3-b"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/move_to_later_commit.go
pkg/integration/tests/patch_building/move_to_later_commit.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveToLaterCommit = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to a later commit", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateDir("dir") shell.CreateFileAndAdd("dir/file1", "file1 content") shell.CreateFileAndAdd("dir/file2", "file2 content") shell.Commit("first commit") shell.UpdateFileAndAdd("dir/file1", "file1 content with old changes") shell.DeleteFileAndAdd("dir/file2") shell.CreateFileAndAdd("dir/file3", "file3 content") shell.Commit("commit to move from") shell.CreateFileAndAdd("unrelated-file", "") shell.Commit("destination commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("destination commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("dir").IsSelected(), Contains(" M file1"), Contains(" D file2"), Contains(" A file3"), ). PressPrimaryAction(). PressEscape() t.Views().Information().Content(Contains("Building patch")) t.Views().Commits(). IsFocused(). SelectPreviousItem() t.Common().SelectPatchOption(Contains("Move patch to selected commit")) t.Views().Commits(). IsFocused(). Lines( Contains("destination commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Equals(" β–Ό dir"), Equals(" M file1"), Equals(" D file2"), Equals(" A file3"), Equals(" A unrelated-file"), ). PressEscape() t.Views().Commits(). IsFocused(). SelectNextItem(). PressEnter() // the original commit has no more files in it t.Views().CommitFiles(). IsFocused(). Lines( Contains("(none)"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/move_to_index_part_of_adjacent_added_lines.go
pkg/integration/tests/patch_building/move_to_index_part_of_adjacent_added_lines.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveToIndexPartOfAdjacentAddedLines = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to the index, with only some lines of a range of adjacent added lines in the patch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "") shell.Commit("first commit") shell.UpdateFileAndAdd("file1", "1st line\n2nd line\n") shell.Commit("commit to move from") shell.UpdateFileAndAdd("unrelated-file", "") shell.Commit("third commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("third commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressEnter() t.Views().PatchBuilding(). IsFocused(). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) t.Common().SelectPatchOption(Contains("Move patch out into index")) t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). Tap(func() { t.Views().Main(). Content(Contains("+2nd line"). DoesNotContain("1st line")) }) t.Views().Files(). Focus(). ContainsLines( Contains("M").Contains("file1"), ) t.Views().Main(). Content(Contains("+1st line\n 2nd line")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/move_to_later_commit_partial_hunk.go
pkg/integration/tests/patch_building/move_to_later_commit_partial_hunk.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveToLaterCommitPartialHunk = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to a later commit, with only parts of a hunk in the patch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "") shell.Commit("first commit") shell.UpdateFileAndAdd("file1", "1st line\n2nd line\n") shell.Commit("commit to move from") shell.UpdateFileAndAdd("unrelated-file", "") shell.Commit("destination commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("destination commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressEnter() t.Views().PatchBuilding(). IsFocused(). PressPrimaryAction(). PressEscape() t.Views().Information().Content(Contains("Building patch")) t.Views().CommitFiles(). IsFocused(). PressEscape() t.Views().Commits(). IsFocused(). SelectPreviousItem() t.Common().SelectPatchOption(Contains("Move patch to selected commit")) t.Views().Commits(). IsFocused(). Lines( Contains("destination commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Contains("file1"), Contains("unrelated-file"), ). SelectNextItem(). Tap(func() { t.Views().Main(). Content(Contains("+1st line\n 2nd line")) }). PressEscape() t.Views().Commits(). IsFocused(). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). Tap(func() { t.Views().Main(). Content(Contains("+2nd line"). DoesNotContain("1st line")) }) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/move_to_index_with_modified_file.go
pkg/integration/tests/patch_building/move_to_index_with_modified_file.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveToIndexWithModifiedFile = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to the index, with a modified file in the working tree that conflicts with the patch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "1\n2\n3\n4\n") shell.Commit("first commit") shell.UpdateFileAndAdd("file1", "11\n2\n3\n4\n") shell.Commit("second commit") shell.UpdateFile("file1", "111\n2\n3\n4\n") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("second commit").IsSelected(), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Equals("M file1"), ). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) t.Views().Secondary().Content(Contains("-1\n+11")) t.Common().SelectPatchOption(Contains("Move patch out into index")) t.ExpectPopup().Confirmation().Title(Equals("Must stash")). Content(Contains("Pulling a patch out into the index requires stashing and unstashing your changes.")). Confirm() t.Views().Files(). Focus(). Lines( Equals("MM file1"), ) t.Views().Main(). Content(Contains("-11\n+111\n")) t.Views().Secondary(). Content(Contains("-1\n+11\n")) t.Views().Stash().IsEmpty() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/move_to_new_commit_from_added_file.go
pkg/integration/tests/patch_building/move_to_new_commit_from_added_file.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveToNewCommitFromAddedFile = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a file that was added in a commit to a new commit", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("first commit") shell.CreateFileAndAdd("file1", "1st line\n2nd line\n3rd line\n") shell.Commit("commit to move from") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit to move from").IsSelected(), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressEnter() t.Views().PatchBuilding(). IsFocused(). SelectNextItem(). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) t.Common().SelectPatchOption(Contains("Move patch into new commit after the original commit")) t.ExpectPopup().CommitMessagePanel(). InitialText(Equals("")). Type("new commit").Confirm() t.Views().Commits(). IsFocused(). Lines( Contains("new commit").IsSelected(), Contains("commit to move from"), Contains("first commit"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("M file1").IsSelected(), ). Tap(func() { t.Views().Main().ContainsLines( Equals(" 1st line"), Equals("+2nd line"), Equals(" 3rd line"), ) }). PressEscape() t.Views().Commits(). IsFocused(). NavigateToLine(Contains("commit to move from")). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("A file1").IsSelected(), ). Tap(func() { t.Views().Main().ContainsLines( Equals("+1st line"), Equals("+3rd line"), ) }) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/move_to_index_with_conflict.go
pkg/integration/tests/patch_building/move_to_index_with_conflict.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveToIndexWithConflict = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Move a patch from a commit to the index, causing a conflict", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "file1 content") shell.Commit("first commit") shell.UpdateFileAndAdd("file1", "file1 content with old changes") shell.Commit("second commit") shell.UpdateFileAndAdd("file1", "file1 content with new changes") shell.Commit("third commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("third commit").IsSelected(), Contains("second commit"), Contains("first commit"), ). SelectNextItem(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) t.Common().SelectPatchOption(Contains("Move patch out into index")) t.Common().AcknowledgeConflicts() t.Views().Files(). IsFocused(). Lines( Contains("UU").Contains("file1"), ). PressEnter() t.Views().MergeConflicts(). IsFocused(). ContainsLines( Contains("<<<<<<< HEAD").IsSelected(), Contains("file1 content").IsSelected(), Contains("=======").IsSelected(), Contains("file1 content with new changes"), Contains(">>>>>>>"), ). PressPrimaryAction() t.Common().ContinueOnConflictsResolved("rebase") t.ExpectPopup().Alert(). Title(Equals("Error")). Content(Contains("Applied patch to 'file1' with conflicts")). Confirm() t.Views().Files(). IsFocused(). Lines( Contains("UU").Contains("file1"), ). PressEnter() t.Views().MergeConflicts(). TopLines( Contains("<<<<<<< ours"), Contains("file1 content"), Contains("======="), Contains("file1 content with old changes"), Contains(">>>>>>> theirs"), ). IsFocused() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/patch_building/apply_in_reverse_with_conflict.go
pkg/integration/tests/patch_building/apply_in_reverse_with_conflict.go
package patch_building import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var ApplyInReverseWithConflict = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Apply a custom patch in reverse, resulting in a conflict", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "file1 content\n") shell.CreateFileAndAdd("file2", "file2 content\n") shell.Commit("first commit") shell.UpdateFileAndAdd("file1", "file1 content\nmore file1 content\n") shell.UpdateFileAndAdd("file2", "file2 content\nmore file2 content\n") shell.Commit("second commit") shell.UpdateFileAndAdd("file1", "file1 content\nmore file1 content\neven more file1\n") shell.Commit("third commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("third commit").IsSelected(), Contains("second commit"), Contains("first commit"), ). NavigateToLine(Contains("second commit")). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Equals(" M file1"), Equals(" M file2"), ). SelectNextItem(). // Add both files to the patch; the first will conflict, the second won't PressPrimaryAction(). Tap(func() { t.Views().Information().Content(Contains("Building patch")) t.Views().Secondary().Content( Contains("+more file1 content")) }). SelectNextItem(). PressPrimaryAction() t.Views().Secondary().Content( Contains("+more file1 content").Contains("+more file2 content")) t.Common().SelectPatchOption(Contains("Apply patch in reverse")) t.ExpectPopup().Alert(). Title(Equals("Error")). Content(Contains("Applied patch to 'file1' with conflicts.")). Confirm() t.Views().Files(). Focus(). Lines( Equals("UU file1").IsSelected(), ). PressEnter() t.Views().MergeConflicts(). IsFocused(). ContainsLines( Contains("file1 content"), Contains("<<<<<<< ours").IsSelected(), Contains("more file1 content").IsSelected(), Contains("even more file1").IsSelected(), Contains("=======").IsSelected(), Contains(">>>>>>> theirs"), ). SelectNextItem(). PressPrimaryAction() t.Views().Files(). Focus(). Lines( Equals("β–Ό /").IsSelected(), Equals(" M file1"), Equals(" M file2"), ). SelectNextItem() t.Views().Main(). ContainsLines( Contains(" file1 content"), Contains("-more file1 content"), Contains("-even more file1"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/stage_children_range_select.go
pkg/integration/tests/file/stage_children_range_select.go
package file import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var StageChildrenRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stage a range of files/folders and their children using range select", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { shell.CreateFile("foo", "") shell.CreateFile("foobar", "") shell.CreateFile("baz/file", "") shell.CreateFile("bazbam/file", "") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Equals(" β–Ό baz"), Equals(" ?? file"), Equals(" β–Ό bazbam"), Equals(" ?? file"), Equals(" ?? foo"), Equals(" ?? foobar"), ). // Select everything Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("foobar")). // Stage PressPrimaryAction(). Lines( Equals("β–Ό /").IsSelected(), Equals(" β–Ό baz").IsSelected(), Equals(" A file").IsSelected(), Equals(" β–Ό bazbam").IsSelected(), Equals(" A file").IsSelected(), Equals(" A foo").IsSelected(), Equals(" A foobar").IsSelected(), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/discard_all_dir_changes.go
pkg/integration/tests/file/discard_all_dir_changes.go
package file import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DiscardAllDirChanges = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Discarding all changes in a directory", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { // typically we would use more bespoke shell methods here, but I struggled to find a way to do that, // and this is copied over from a legacy integration test which did everything in a big shell script // so I'm just copying it across. shell.CreateDir("dir") // common stuff shell.RunShellCommand(`echo test > dir/both-deleted.txt`) shell.RunShellCommand(`git checkout -b conflict && git add dir/both-deleted.txt`) shell.RunShellCommand(`echo bothmodded > dir/both-modded.txt && git add dir/both-modded.txt`) shell.RunShellCommand(`echo haha > dir/deleted-them.txt && git add dir/deleted-them.txt`) shell.RunShellCommand(`echo haha2 > dir/deleted-us.txt && git add dir/deleted-us.txt`) shell.RunShellCommand(`echo mod > dir/modded.txt && git add dir/modded.txt`) shell.RunShellCommand(`echo mod > dir/modded-staged.txt && git add dir/modded-staged.txt`) shell.RunShellCommand(`echo del > dir/deleted.txt && git add dir/deleted.txt`) shell.RunShellCommand(`echo del > dir/deleted-staged.txt && git add dir/deleted-staged.txt`) shell.RunShellCommand(`echo change-delete > dir/change-delete.txt && git add dir/change-delete.txt`) shell.RunShellCommand(`echo delete-change > dir/delete-change.txt && git add dir/delete-change.txt`) shell.RunShellCommand(`echo double-modded > dir/double-modded.txt && git add dir/double-modded.txt`) shell.RunShellCommand(`echo "renamed\nhaha" > dir/renamed.txt && git add dir/renamed.txt`) shell.RunShellCommand(`git commit -m one`) // stuff on other branch shell.RunShellCommand(`git branch conflict_second && git mv dir/both-deleted.txt dir/added-them-changed-us.txt`) shell.RunShellCommand(`git commit -m "dir/both-deleted.txt renamed in dir/added-them-changed-us.txt"`) shell.RunShellCommand(`echo blah > dir/both-added.txt && git add dir/both-added.txt`) shell.RunShellCommand(`echo mod1 > dir/both-modded.txt && git add dir/both-modded.txt`) shell.RunShellCommand(`rm dir/deleted-them.txt && git add dir/deleted-them.txt`) shell.RunShellCommand(`echo modded > dir/deleted-us.txt && git add dir/deleted-us.txt`) shell.RunShellCommand(`git commit -m "two"`) // stuff on our branch shell.RunShellCommand(`git checkout conflict_second`) shell.RunShellCommand(`git mv dir/both-deleted.txt dir/changed-them-added-us.txt`) shell.RunShellCommand(`git commit -m "both-deleted.txt renamed in dir/changed-them-added-us.txt"`) shell.RunShellCommand(`echo mod2 > dir/both-modded.txt && git add dir/both-modded.txt`) shell.RunShellCommand(`echo blah2 > dir/both-added.txt && git add dir/both-added.txt`) shell.RunShellCommand(`echo modded > dir/deleted-them.txt && git add dir/deleted-them.txt`) shell.RunShellCommand(`rm dir/deleted-us.txt && git add dir/deleted-us.txt`) shell.RunShellCommand(`git commit -m "three"`) shell.RunShellCommand(`git reset --hard conflict_second`) shell.RunCommandExpectError([]string{"git", "merge", "conflict"}) shell.RunShellCommand(`echo "new" > dir/new.txt`) shell.RunShellCommand(`echo "new staged" > dir/new-staged.txt && git add dir/new-staged.txt`) shell.RunShellCommand(`echo mod2 > dir/modded.txt`) shell.RunShellCommand(`echo mod2 > dir/modded-staged.txt && git add dir/modded-staged.txt`) shell.RunShellCommand(`rm dir/deleted.txt`) shell.RunShellCommand(`rm dir/deleted-staged.txt && git add dir/deleted-staged.txt`) shell.RunShellCommand(`echo change-delete2 > dir/change-delete.txt && git add dir/change-delete.txt`) shell.RunShellCommand(`rm dir/change-delete.txt`) shell.RunShellCommand(`rm dir/delete-change.txt && git add dir/delete-change.txt`) shell.RunShellCommand(`echo "changed" > dir/delete-change.txt`) shell.RunShellCommand(`echo "change1" > dir/double-modded.txt && git add dir/double-modded.txt`) shell.RunShellCommand(`echo "change2" > dir/double-modded.txt`) shell.RunShellCommand(`echo before > dir/added-changed.txt && git add dir/added-changed.txt`) shell.RunShellCommand(`echo after > dir/added-changed.txt`) shell.RunShellCommand(`rm dir/renamed.txt && git add dir/renamed.txt`) shell.RunShellCommand(`echo "renamed\nhaha" > dir/renamed2.txt && git add dir/renamed2.txt`) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Contains("dir").IsSelected(), Contains("UA").Contains("added-them-changed-us.txt"), Contains("AA").Contains("both-added.txt"), Contains("DD").Contains("both-deleted.txt"), Contains("UU").Contains("both-modded.txt"), Contains("AU").Contains("changed-them-added-us.txt"), Contains("UD").Contains("deleted-them.txt"), Contains("DU").Contains("deleted-us.txt"), ). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Discard changes")). Select(Contains("Discard all changes")). Confirm() }). Tap(func() { t.Common().ContinueOnConflictsResolved("merge") t.ExpectPopup().Confirmation(). Title(Equals("Continue")). Content(Contains("Files have been modified since conflicts were resolved. Auto-stage them and continue?")). Cancel() t.GlobalPress(keys.Universal.CreateRebaseOptionsMenu) t.ExpectPopup().Menu(). Title(Equals("Merge options")). Select(Contains("continue")). Confirm() }). Lines( Contains("dir").IsSelected(), Contains(" M").Contains("added-changed.txt"), Contains(" D").Contains("change-delete.txt"), Contains("??").Contains("delete-change.txt"), Contains(" D").Contains("deleted.txt"), Contains(" M").Contains("double-modded.txt"), Contains(" M").Contains("modded.txt"), Contains("??").Contains("new.txt"), ). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Discard changes")). Select(Contains("Discard all changes")). Confirm() }). IsEmpty() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/renamed_files.go
pkg/integration/tests/file/renamed_files.go
package file import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RenamedFiles = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Regression test for the display of renamed files in the file tree", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { shell.CreateDir("dir") shell.CreateDir("dir/nested") shell.CreateFileAndAdd("file1", "file1 content\n") shell.CreateFileAndAdd("dir/file2", "file2 content\n") shell.CreateFileAndAdd("dir/nested/file3", "file3 content\n") shell.Commit("initial commit") shell.RunCommand([]string{"git", "mv", "file1", "dir/file1"}) shell.RunCommand([]string{"git", "mv", "dir/file2", "dir/file2-renamed"}) shell.RunCommand([]string{"git", "mv", "dir/nested/file3", "file3"}) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Equals("β–Ό /"), Equals(" β–Ό dir"), Equals(" R file1 β†’ file1"), Equals(" R file2 β†’ file2-renamed"), Equals(" R dir/nested/file3 β†’ file3"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/discard_various_changes.go
pkg/integration/tests/file/discard_various_changes.go
package file import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DiscardVariousChanges = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Discarding all possible permutations of changed files", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { createAllPossiblePermutationsOfChangedFiles(shell) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { type statusFile struct { status string label string } t.Views().Files(). IsFocused(). TopLines( Equals("β–Ό /").IsSelected(), ) discardOneByOne := func(files []statusFile) { for _, file := range files { t.Views().Files(). IsFocused(). NavigateToLine(Contains(file.status + " " + file.label)). Press(keys.Universal.Remove) t.ExpectPopup().Menu(). Title(Equals("Discard changes")). Select(Contains("Discard all changes")). Confirm() } } discardOneByOne([]statusFile{ {status: "UA", label: "added-them-changed-us.txt"}, {status: "AA", label: "both-added.txt"}, {status: "DD", label: "both-deleted.txt"}, {status: "UU", label: "both-modded.txt"}, {status: "AU", label: "changed-them-added-us.txt"}, {status: "UD", label: "deleted-them.txt"}, {status: "DU", label: "deleted-us.txt"}, }) t.ExpectPopup().Confirmation(). Title(Equals("Continue")). Content(Contains("All merge conflicts resolved. Continue the merge?")). Cancel() discardOneByOne([]statusFile{ {status: "AM", label: "added-changed.txt"}, {status: "MD", label: "change-delete.txt"}, {status: "D ", label: "delete-change.txt"}, {status: "D ", label: "deleted-staged.txt"}, {status: " D", label: "deleted.txt"}, {status: "MM", label: "double-modded.txt"}, {status: "M ", label: "modded-staged.txt"}, {status: " M", label: "modded.txt"}, {status: "A ", label: "new-staged.txt"}, {status: "??", label: "new.txt"}, // the menu title only includes the new file {status: "R ", label: "renamed.txt β†’ renamed2.txt"}, }) t.Views().Files().IsEmpty() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/discard_unstaged_dir_changes.go
pkg/integration/tests/file/discard_unstaged_dir_changes.go
package file import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DiscardUnstagedDirChanges = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Discarding unstaged changes in a directory", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { shell.CreateDir("dir") shell.CreateFileAndAdd("dir/file-one", "original content\n") shell.Commit("first commit") shell.UpdateFileAndAdd("dir/file-one", "original content\nnew content\n") shell.UpdateFile("dir/file-one", "original content\nnew content\neven newer content\n") shell.CreateDir("dir/subdir") shell.CreateFile("dir/subdir/unstaged-file-one", "unstaged file") shell.CreateFile("dir/unstaged-file-two", "unstaged file") shell.CreateFile("unstaged-file-three", "unstaged file") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Equals(" β–Ό dir"), Equals(" β–Ό subdir"), Equals(" ?? unstaged-file-one"), Equals(" MM file-one"), Equals(" ?? unstaged-file-two"), Equals(" ?? unstaged-file-three"), ). SelectNextItem(). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Discard changes")). Select(Contains("Discard unstaged changes")). Confirm() }). Lines( Equals("β–Ό /"), Equals(" β–Ό dir").IsSelected(), Equals(" M file-one"), // this guy remains untouched because it wasn't inside the 'dir' directory Equals(" ?? unstaged-file-three"), ) t.FileSystem().FileContent("dir/file-one", Equals("original content\nnew content\n")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/gitignore.go
pkg/integration/tests/file/gitignore.go
package file import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var Gitignore = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Verify that we can't ignore the .gitignore file, then ignore/exclude other files", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { shell.CreateFile(".gitignore", "") shell.CreateFile("toExclude", "") shell.CreateFile("toIgnore", "") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Equals(" ?? .gitignore"), Equals(" ?? toExclude"), Equals(" ?? toIgnore"), ). SelectNextItem(). Press(keys.Files.IgnoreFile). // ensure we can't exclude the .gitignore file Tap(func() { t.ExpectPopup().Menu().Title(Equals("Ignore or exclude file")).Select(Contains("Add to .git/info/exclude")).Confirm() t.ExpectPopup().Alert().Title(Equals("Error")).Content(Equals("Cannot exclude .gitignore")).Confirm() }). Press(keys.Files.IgnoreFile). // ensure we can't ignore the .gitignore file Tap(func() { t.ExpectPopup().Menu().Title(Equals("Ignore or exclude file")).Select(Contains("Add to .gitignore")).Confirm() t.ExpectPopup().Alert().Title(Equals("Error")).Content(Equals("Cannot ignore .gitignore")).Confirm() t.FileSystem().FileContent(".gitignore", Equals("")) t.FileSystem().FileContent(".git/info/exclude", DoesNotContain(".gitignore")) }). SelectNextItem(). Press(keys.Files.IgnoreFile). // exclude a file Tap(func() { t.ExpectPopup().Menu().Title(Equals("Ignore or exclude file")).Select(Contains("Add to .git/info/exclude")).Confirm() t.FileSystem().FileContent(".gitignore", Equals("")) t.FileSystem().FileContent(".git/info/exclude", Contains("toExclude")) }). SelectNextItem(). Press(keys.Files.IgnoreFile). // ignore a file Tap(func() { t.ExpectPopup().Menu().Title(Equals("Ignore or exclude file")).Select(Contains("Add to .gitignore")).Confirm() t.FileSystem().FileContent(".gitignore", Equals("toIgnore\n")) t.FileSystem().FileContent(".git/info/exclude", Contains("toExclude")) }) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/remember_commit_message_after_fail.go
pkg/integration/tests/file/remember_commit_message_after_fail.go
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: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { shell.CreateFile(".git/hooks/pre-commit", preCommitHook) shell.MakeExecutable(".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( Equals("β–Ό /"), 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() }). NavigateToLine(Contains("bad")). Press(keys.Universal.Remove). // remove file that triggers pre-commit hook to fail Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Discard changes")). 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"), ) }) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/discard_staged_changes.go
pkg/integration/tests/file/discard_staged_changes.go
package file import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DiscardStagedChanges = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Discarding staged changes", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("fileToRemove", "original content") shell.CreateFileAndAdd("file2", "original content") shell.Commit("first commit") shell.CreateFile("file3", "original content") shell.UpdateFile("fileToRemove", "new content") shell.UpdateFile("file2", "new content") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Equals(" M file2"), Equals(" ?? file3"), Equals(" M fileToRemove"), ). NavigateToLine(Contains(`fileToRemove`)). PressPrimaryAction(). Lines( Equals("β–Ό /"), Equals(" M file2"), Equals(" ?? file3"), Equals(" M fileToRemove").IsSelected(), ). Press(keys.Files.ViewResetOptions) t.ExpectPopup().Menu().Title(Equals("")).Select(Contains("Discard staged changes")).Confirm() // staged file has been removed t.Views().Files(). Lines( Equals("β–Ό /"), Equals(" M file2"), Equals(" ?? file3").IsSelected(), ) // the file should have the same content that it originally had, given that that was committed already t.FileSystem().FileContent("fileToRemove", Equals("original content")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/collapse_expand.go
pkg/integration/tests/file/collapse_expand.go
package file import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var CollapseExpand = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Collapsing and expanding all files in the file tree", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { shell.CreateDir("dir") shell.CreateFile("dir/file-one", "original content\n") shell.CreateDir("dir2") shell.CreateFile("dir2/file-two", "original content\n") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Equals(" β–Ό dir"), Equals(" ?? file-one"), Equals(" β–Ό dir2"), Equals(" ?? file-two"), ) t.Views().Files(). Press(keys.Files.CollapseAll). Lines( Equals("β–Ά /"), ) t.Views().Files(). Press(keys.Files.ExpandAll). Lines( Equals("β–Ό /").IsSelected(), Equals(" β–Ό dir"), Equals(" ?? file-one"), Equals(" β–Ό dir2"), Equals(" ?? file-two"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/stage_range_select.go
pkg/integration/tests/file/stage_range_select.go
package file import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var StageRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stage/unstage a range of files using range select", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("dir2/file-d", "old content") shell.Commit("first commit") shell.UpdateFile("dir2/file-d", "new content") shell.CreateFile("dir1/file-a", "") shell.CreateFile("dir1/file-b", "") shell.CreateFile("dir2/file-c", "") shell.CreateFile("file-e", "") shell.CreateFile("file-f", "") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Equals(" β–Ό dir1"), Equals(" ?? file-a"), Equals(" ?? file-b"), Equals(" β–Ό dir2"), Equals(" ?? file-c"), Equals(" M file-d"), Equals(" ?? file-e"), Equals(" ?? file-f"), ). NavigateToLine(Contains("file-b")). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("file-c")). // Stage PressPrimaryAction(). Lines( Equals("β–Ό /"), Equals(" β–Ό dir1"), Equals(" ?? file-a"), Equals(" A file-b").IsSelected(), Equals(" β–Ό dir2").IsSelected(), Equals(" A file-c").IsSelected(), // Staged because dir2 was part of the selection when he hit space Equals(" M file-d"), Equals(" ?? file-e"), Equals(" ?? file-f"), ). // Unstage; back to everything being unstaged PressPrimaryAction(). Lines( Equals("β–Ό /"), Equals(" β–Ό dir1"), Equals(" ?? file-a"), Equals(" ?? file-b").IsSelected(), Equals(" β–Ό dir2").IsSelected(), Equals(" ?? file-c").IsSelected(), Equals(" M file-d"), Equals(" ?? file-e"), Equals(" ?? file-f"), ). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("dir2")). // Verify that collapsed directories can be included in the range. // Collapse the directory PressEnter(). Lines( Equals("β–Ό /"), Equals(" β–Ό dir1"), Equals(" ?? file-a"), Equals(" ?? file-b"), Equals(" β–Ά dir2").IsSelected(), Equals(" ?? file-e"), Equals(" ?? file-f"), ). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("file-e")). // Stage PressPrimaryAction(). Lines( Equals("β–Ό /"), Equals(" β–Ό dir1"), Equals(" ?? file-a"), Equals(" ?? file-b"), Equals(" β–Ά dir2").IsSelected(), Equals(" A file-e").IsSelected(), Equals(" ?? file-f"), ). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("dir2")). // Expand the directory again to verify it's been staged PressEnter(). Lines( Equals("β–Ό /"), Equals(" β–Ό dir1"), Equals(" ?? file-a"), Equals(" ?? file-b"), Equals(" β–Ό dir2").IsSelected(), Equals(" A file-c"), Equals(" M file-d"), Equals(" A file-e"), Equals(" ?? file-f"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/dir_with_untracked_file.go
pkg/integration/tests/file/dir_with_untracked_file.go
package file import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DirWithUntrackedFile = NewIntegrationTest(NewIntegrationTestArgs{ // notably, we currently _don't_ actually see the untracked file in the diff. Not sure how to get around that. Description: "When selecting a directory that contains an untracked file, we should not get an error", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateDir("dir") shell.CreateFile("dir/file", "foo") shell.GitAddAll() shell.Commit("first commit") shell.CreateFile("dir/untracked", "bar") shell.UpdateFile("dir/file", "baz") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Lines( Contains("first commit"), ) t.Views().Main(). Content(DoesNotContain("error: Could not access")). // we show baz because it's a modified file but we don't show bar because it's untracked // (though it would be cool if we could show that too) Content(Contains("baz")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/discard_range_select.go
pkg/integration/tests/file/discard_range_select.go
package file import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DiscardRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Discard a range of files using range select", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("dir2/file-2b", "old content") shell.CreateFileAndAdd("dir3/file-3b", "old content") shell.Commit("first commit") shell.UpdateFile("dir2/file-2b", "new content") shell.UpdateFile("dir3/file-3b", "new content") shell.CreateFile("dir1/file-1a", "") shell.CreateFile("dir1/file-1b", "") shell.CreateFile("dir2/file-2a", "") shell.CreateFile("dir3/file-3a", "") shell.CreateFile("file-a", "") shell.CreateFile("file-b", "") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Equals(" β–Ό dir1"), Equals(" ?? file-1a"), Equals(" ?? file-1b"), Equals(" β–Ό dir2"), Equals(" ?? file-2a"), Equals(" M file-2b"), Equals(" β–Ό dir3"), Equals(" ?? file-3a"), Equals(" M file-3b"), Equals(" ?? file-a"), Equals(" ?? file-b"), ). NavigateToLine(Contains("file-1b")). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("file-2a")). Lines( Equals("β–Ό /"), Equals(" β–Ό dir1"), Equals(" ?? file-1a"), Equals(" ?? file-1b").IsSelected(), Equals(" β–Ό dir2").IsSelected(), Equals(" ?? file-2a").IsSelected(), Equals(" M file-2b"), Equals(" β–Ό dir3"), Equals(" ?? file-3a"), Equals(" M file-3b"), Equals(" ?? file-a"), Equals(" ?? file-b"), ). // Discard Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Discard changes")). Select(Contains("Discard all changes")). Confirm() }). Lines( Equals("β–Ό /"), Equals(" β–Ό dir1"), Equals(" ?? file-1a"), Equals(" β–Ό dir3").IsSelected(), Equals(" ?? file-3a"), Equals(" M file-3b"), Equals(" ?? file-a"), Equals(" ?? file-b"), ). // Verify you can discard collapsed directories in range select PressEnter(). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("file-a")). Lines( Equals("β–Ό /"), Equals(" β–Ό dir1"), Equals(" ?? file-1a"), Equals(" β–Ά dir3").IsSelected(), Equals(" ?? file-a").IsSelected(), Equals(" ?? file-b"), ). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Discard changes")). Select(Contains("Discard all changes")). Confirm() }). Lines( Equals("β–Ό /"), Equals(" β–Ό dir1"), Equals(" ?? file-1a"), Equals(" ?? file-b").IsSelected(), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/renamed_files_no_root_item.go
pkg/integration/tests/file/renamed_files_no_root_item.go
package file import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RenamedFilesNoRootItem = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Regression test for the display of renamed files in the file tree, when the root item is disabled", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Gui.ShowRootItemInFileTree = false }, SetupRepo: func(shell *Shell) { shell.CreateDir("dir") shell.CreateDir("dir/nested") shell.CreateFileAndAdd("file1", "file1 content\n") shell.CreateFileAndAdd("dir/file2", "file2 content\n") shell.CreateFileAndAdd("dir/nested/file3", "file3 content\n") shell.Commit("initial commit") shell.RunCommand([]string{"git", "mv", "file1", "dir/file1"}) shell.RunCommand([]string{"git", "mv", "dir/file2", "dir/file2-renamed"}) shell.RunCommand([]string{"git", "mv", "dir/nested/file3", "file3"}) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Equals("β–Ό dir"), Equals(" R file1 β†’ file1"), Equals(" R file2 β†’ file2-renamed"), Equals("R dir/nested/file3 β†’ file3"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/shared.go
pkg/integration/tests/file/shared.go
package file import ( . "github.com/jesseduffield/lazygit/pkg/integration/components" ) func createAllPossiblePermutationsOfChangedFiles(shell *Shell) { // typically we would use more bespoke shell methods here, but I struggled to find a way to do that, // and this is copied over from a legacy integration test which did everything in a big shell script // so I'm just copying it across. // common stuff shell.RunShellCommand(`echo test > both-deleted.txt`) shell.RunShellCommand(`git checkout -b conflict && git add both-deleted.txt`) shell.RunShellCommand(`echo bothmodded > both-modded.txt && git add both-modded.txt`) shell.RunShellCommand(`echo haha > deleted-them.txt && git add deleted-them.txt`) shell.RunShellCommand(`echo haha2 > deleted-us.txt && git add deleted-us.txt`) shell.RunShellCommand(`echo mod > modded.txt && git add modded.txt`) shell.RunShellCommand(`echo mod > modded-staged.txt && git add modded-staged.txt`) shell.RunShellCommand(`echo del > deleted.txt && git add deleted.txt`) shell.RunShellCommand(`echo del > deleted-staged.txt && git add deleted-staged.txt`) shell.RunShellCommand(`echo change-delete > change-delete.txt && git add change-delete.txt`) shell.RunShellCommand(`echo delete-change > delete-change.txt && git add delete-change.txt`) shell.RunShellCommand(`echo double-modded > double-modded.txt && git add double-modded.txt`) shell.RunShellCommand(`echo "renamed\nhaha" > renamed.txt && git add renamed.txt`) shell.RunShellCommand(`git commit -m one`) // stuff on other branch shell.RunShellCommand(`git branch conflict_second && git mv both-deleted.txt added-them-changed-us.txt`) shell.RunShellCommand(`git commit -m "both-deleted.txt renamed in added-them-changed-us.txt"`) shell.RunShellCommand(`echo blah > both-added.txt && git add both-added.txt`) shell.RunShellCommand(`echo mod1 > both-modded.txt && git add both-modded.txt`) shell.RunShellCommand(`rm deleted-them.txt && git add deleted-them.txt`) shell.RunShellCommand(`echo modded > deleted-us.txt && git add deleted-us.txt`) shell.RunShellCommand(`git commit -m "two"`) // stuff on our branch shell.RunShellCommand(`git checkout conflict_second`) shell.RunShellCommand(`git mv both-deleted.txt changed-them-added-us.txt`) shell.RunShellCommand(`git commit -m "both-deleted.txt renamed in changed-them-added-us.txt"`) shell.RunShellCommand(`echo mod2 > both-modded.txt && git add both-modded.txt`) shell.RunShellCommand(`echo blah2 > both-added.txt && git add both-added.txt`) shell.RunShellCommand(`echo modded > deleted-them.txt && git add deleted-them.txt`) shell.RunShellCommand(`rm deleted-us.txt && git add deleted-us.txt`) shell.RunShellCommand(`git commit -m "three"`) shell.RunShellCommand(`git reset --hard conflict_second`) shell.RunCommandExpectError([]string{"git", "merge", "conflict"}) shell.RunShellCommand(`echo "new" > new.txt`) shell.RunShellCommand(`echo "new staged" > new-staged.txt && git add new-staged.txt`) shell.RunShellCommand(`echo mod2 > modded.txt`) shell.RunShellCommand(`echo mod2 > modded-staged.txt && git add modded-staged.txt`) shell.RunShellCommand(`rm deleted.txt`) shell.RunShellCommand(`rm deleted-staged.txt && git add deleted-staged.txt`) shell.RunShellCommand(`echo change-delete2 > change-delete.txt && git add change-delete.txt`) shell.RunShellCommand(`rm change-delete.txt`) shell.RunShellCommand(`rm delete-change.txt && git add delete-change.txt`) shell.RunShellCommand(`echo "changed" > delete-change.txt`) shell.RunShellCommand(`echo "change1" > double-modded.txt && git add double-modded.txt`) shell.RunShellCommand(`echo "change2" > double-modded.txt`) shell.RunShellCommand(`echo before > added-changed.txt && git add added-changed.txt`) shell.RunShellCommand(`echo after > added-changed.txt`) shell.RunShellCommand(`rm renamed.txt && git add renamed.txt`) shell.RunShellCommand(`echo "renamed\nhaha" > renamed2.txt && git add renamed2.txt`) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/gitignore_special_characters.go
pkg/integration/tests/file/gitignore_special_characters.go
package file import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var GitignoreSpecialCharacters = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Ignore files with special characters in their names", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { shell.CreateFile(".gitignore", "") shell.CreateFile("#file", "") shell.CreateFile("file#abc", "") shell.CreateFile("!file", "") shell.CreateFile("file!abc", "") shell.CreateFile("abc*def", "") shell.CreateFile("abc_def", "") shell.CreateFile("file[x]", "") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { excludeFile := func(fileName string) { t.Views().Files(). NavigateToLine(Contains(fileName)). Press(keys.Files.IgnoreFile) t.ExpectPopup().Menu(). Title(Equals("Ignore or exclude file")). Select(Contains("Add to .gitignore")). Confirm() } t.Views().Files(). Focus(). Lines( Equals("β–Ό /"), Equals(" ?? !file"), Equals(" ?? #file"), Equals(" ?? .gitignore"), Equals(" ?? abc*def"), Equals(" ?? abc_def"), Equals(" ?? file!abc"), Equals(" ?? file#abc"), Equals(" ?? file[x]"), ) excludeFile("#file") excludeFile("file#abc") excludeFile("!file") excludeFile("file!abc") excludeFile("abc*def") excludeFile("file[x]") t.Views().Files(). Lines( Equals("β–Ό /"), Equals(" ?? .gitignore"), Equals(" ?? abc_def"), ) t.FileSystem().FileContent(".gitignore", Equals("\\#file\nfile#abc\n\\!file\nfile!abc\nabc\\*def\nfile\\[x\\]\n")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/copy_menu.go
pkg/integration/tests/file/copy_menu.go
package file import ( "os" "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) // note: this is required to simulate the clipboard during CI func expectClipboard(t *TestDriver, matcher *TextMatcher) { defer t.Shell().DeleteFile("clipboard") t.FileSystem().FileContent("clipboard", matcher) } var CopyMenu = NewIntegrationTest(NewIntegrationTestArgs{ Description: "The copy menu allows to copy name and diff of selected/all files", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > clipboard" }, SetupRepo: func(shell *Shell) {}, Run: func(t *TestDriver, keys config.KeybindingConfig) { // Disabled item t.Views().Files(). IsEmpty(). Press(keys.Files.CopyFileInfoToClipboard). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Copy to clipboard")). Select(Contains("File name")). Tooltip(Equals("Disabled: No item selected")). Confirm(). Tap(func() { t.ExpectToast(Equals("Disabled: No item selected")) }). Cancel() }) t.Shell(). CreateDir("dir"). CreateFile("dir/1-unstaged_file", "unstaged content") // Empty content (new file) t.Views().Files(). Press(keys.Universal.Refresh). Lines( Contains("dir").IsSelected(), Contains("unstaged_file"), ). SelectNextItem(). Press(keys.Files.CopyFileInfoToClipboard). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Copy to clipboard")). Select(Contains("Diff of selected file")). Tooltip(Contains("Disabled: Nothing to copy")). Confirm(). Tap(func() { t.ExpectToast(Equals("Disabled: Nothing to copy")) }). Cancel() }). Press(keys.Files.CopyFileInfoToClipboard). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Copy to clipboard")). Select(Contains("Diff of all files")). Tooltip(Contains("Disabled: Nothing to copy")). Confirm(). Tap(func() { t.ExpectToast(Equals("Disabled: Nothing to copy")) }). Cancel() }) t.Shell(). GitAdd("dir/1-unstaged_file"). Commit("commit-unstaged"). UpdateFile("dir/1-unstaged_file", "unstaged content (new)"). CreateFileAndAdd("dir/2-staged_file", "staged content"). Commit("commit-staged"). UpdateFile("dir/2-staged_file", "staged content (new)"). GitAdd("dir/2-staged_file") // Copy file name t.Views().Files(). Press(keys.Universal.Refresh). Lines( Contains("dir"), Contains("unstaged_file").IsSelected(), Contains("staged_file"), ). Press(keys.Files.CopyFileInfoToClipboard). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Copy to clipboard")). Select(Contains("File name")). Confirm() t.ExpectToast(Equals("File name copied to clipboard")) expectClipboard(t, Equals("1-unstaged_file")) }) // Copy relative file path t.Views().Files(). Press(keys.Files.CopyFileInfoToClipboard). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Copy to clipboard")). Select(Contains("Relative path")). Confirm() t.ExpectToast(Equals("File path copied to clipboard")) expectClipboard(t, Equals("dir/1-unstaged_file")) }) // Copy absolute file path t.Views().Files(). Press(keys.Files.CopyFileInfoToClipboard). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Copy to clipboard")). Select(Contains("Absolute path")). Confirm() t.ExpectToast(Equals("File path copied to clipboard")) repoDir, _ := os.Getwd() // On windows the following path would have backslashes, but we don't run integration tests on windows yet. expectClipboard(t, Equals(repoDir+"/dir/1-unstaged_file")) }) // Selected path diff on a single (unstaged) file t.Views().Files(). Press(keys.Files.CopyFileInfoToClipboard). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Copy to clipboard")). Select(Contains("Diff of selected file")). Tooltip(Equals("If there are staged items, this command considers only them. Otherwise, it considers all the unstaged ones.")). Confirm() t.ExpectToast(Equals("File diff copied to clipboard")) expectClipboard(t, Contains("+unstaged content (new)")) }) // Selected path diff with staged and unstaged files t.Views().Files(). SelectPreviousItem(). Lines( Contains("dir").IsSelected(), Contains("unstaged_file"), Contains("staged_file"), ). Press(keys.Files.CopyFileInfoToClipboard). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Copy to clipboard")). Select(Contains("Diff of selected file")). Tooltip(Equals("If there are staged items, this command considers only them. Otherwise, it considers all the unstaged ones.")). Confirm() t.ExpectToast(Equals("File diff copied to clipboard")) expectClipboard(t, Contains("+staged content (new)")) }) // All files diff with staged files t.Views().Files(). Press(keys.Files.CopyFileInfoToClipboard). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Copy to clipboard")). Select(Contains("Diff of all files")). Tooltip(Equals("If there are staged items, this command considers only them. Otherwise, it considers all the unstaged ones.")). Confirm() t.ExpectToast(Equals("All files diff copied to clipboard")) expectClipboard(t, Contains("+staged content (new)")) }) // All files diff with no staged files t.Views().Files(). SelectNextItem(). SelectNextItem(). Lines( Contains("dir"), Contains("unstaged_file"), Contains("staged_file").IsSelected(), ). Press(keys.Universal.Select). Press(keys.Files.CopyFileInfoToClipboard). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Copy to clipboard")). Select(Contains("Diff of all files")). Tooltip(Equals("If there are staged items, this command considers only them. Otherwise, it considers all the unstaged ones.")). Confirm() t.ExpectToast(Equals("All files diff copied to clipboard")) expectClipboard(t, Contains("+staged content (new)").Contains("+unstaged content (new)")) }) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/discard_various_changes_range_select.go
pkg/integration/tests/file/discard_various_changes_range_select.go
package file import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DiscardVariousChangesRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Discarding all possible permutations of changed files via range select", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { createAllPossiblePermutationsOfChangedFiles(shell) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Equals(" UA added-them-changed-us.txt"), Equals(" AA both-added.txt"), Equals(" DD both-deleted.txt"), Equals(" UU both-modded.txt"), Equals(" AU changed-them-added-us.txt"), Equals(" UD deleted-them.txt"), Equals(" DU deleted-us.txt"), ). SelectNextItem(). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("deleted-us.txt")). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Discard changes")). Select(Contains("Discard all changes")). Confirm() t.ExpectPopup().Confirmation(). Title(Equals("Continue")). Content(Contains("All merge conflicts resolved. Continue the merge?")). Cancel() }). Lines( Equals("β–Ό /").IsSelected(), Equals(" AM added-changed.txt"), Equals(" MD change-delete.txt"), Equals(" D delete-change.txt"), Equals(" D deleted-staged.txt"), Equals(" D deleted.txt"), Equals(" MM double-modded.txt"), Equals(" M modded-staged.txt"), Equals(" M modded.txt"), Equals(" A new-staged.txt"), Equals(" ?? new.txt"), Equals(" R renamed.txt β†’ renamed2.txt"), ). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("renamed.txt")). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Discard changes")). Select(Contains("Discard all changes")). Confirm() }) t.Views().Files().IsEmpty() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/discard_unstaged_file_changes.go
pkg/integration/tests/file/discard_unstaged_file_changes.go
package file import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DiscardUnstagedFileChanges = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Discarding unstaged changes in a file", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file-one", "original content\n") shell.Commit("first commit") shell.UpdateFileAndAdd("file-one", "original content\nnew content\n") shell.UpdateFile("file-one", "original content\nnew content\neven newer content\n") shell.CreateFileAndAdd("file-two", "original content\n") shell.UpdateFile("file-two", "original content\nnew content\n") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Equals(" MM file-one"), Equals(" AM file-two"), ). SelectNextItem(). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Discard changes")). Select(Contains("Discard unstaged changes")). Confirm() }). Lines( Equals("β–Ό /"), Equals(" M file-one").IsSelected(), Equals(" AM file-two"), ). SelectNextItem(). Lines( Equals("β–Ό /"), Equals(" M file-one"), Equals(" AM file-two").IsSelected(), ). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Discard changes")). Select(Contains("Discard unstaged changes")). Confirm() }). Lines( Equals("β–Ό /"), Equals(" M file-one"), Equals(" A file-two").IsSelected(), ) t.FileSystem().FileContent("file-one", Equals("original content\nnew content\n")) t.FileSystem().FileContent("file-two", Equals("original content\n")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/discard_unstaged_range_select.go
pkg/integration/tests/file/discard_unstaged_range_select.go
package file import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DiscardUnstagedRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Discard unstaged changed in a range of files using range select", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("dir2/file-d", "old content") shell.Commit("first commit") shell.UpdateFile("dir2/file-d", "new content") shell.CreateFile("dir1/file-a", "") shell.CreateFile("dir1/file-b", "") shell.CreateFileAndAdd("dir2/file-c", "") shell.CreateFile("file-e", "") shell.CreateFile("file-f", "") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Equals(" β–Ό dir1"), Equals(" ?? file-a"), Equals(" ?? file-b"), Equals(" β–Ό dir2"), Equals(" A file-c"), Equals(" M file-d"), Equals(" ?? file-e"), Equals(" ?? file-f"), ). NavigateToLine(Contains("file-b")). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("file-c")). Lines( Equals("β–Ό /"), Equals(" β–Ό dir1"), Equals(" ?? file-a"), Equals(" ?? file-b").IsSelected(), Equals(" β–Ό dir2").IsSelected(), Equals(" A file-c").IsSelected(), Equals(" M file-d"), Equals(" ?? file-e"), Equals(" ?? file-f"), ). // Discard Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Discard changes")). Select(Contains("Discard unstaged changes")). Confirm() }). // file-b is gone because it was selected and contained no staged changes. // file-c is still there because it contained no unstaged changes // file-d is gone because it was selected via dir2 and contained only unstaged changes Lines( Equals("β–Ό /"), Equals(" β–Ό dir1"), Equals(" ?? file-a"), Equals(" β–Ό dir2"), // Re-selecting file-c because it's where the selected line index // was before performing the action. Equals(" A file-c").IsSelected(), Equals(" ?? file-e"), Equals(" ?? file-f"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/rename_similarity_threshold_change.go
pkg/integration/tests/file/rename_similarity_threshold_change.go
package file import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RenameSimilarityThresholdChange = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Change the rename similarity threshold while in the files panel", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("original", "one\ntwo\nthree\nfour\nfive\n") shell.Commit("add original") shell.DeleteFileAndAdd("original") shell.CreateFileAndAdd("renamed", "one\ntwo\nthree\nfour\nfive\nsix\nseven\neight\nnine\nten\n") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Equals("β–Ό /"), Equals(" D original"), Equals(" A renamed"), ). Press(keys.Universal.DecreaseRenameSimilarityThreshold). Tap(func() { t.ExpectToast(Equals("Changed rename similarity threshold to 45%")) }). Lines( Equals("R original β†’ renamed"), ). Press(keys.Universal.FocusMainView). Tap(func() { t.Views().Main(). Press(keys.Universal.IncreaseRenameSimilarityThreshold) t.ExpectToast(Equals("Changed rename similarity threshold to 50%")) }). Lines( Equals("β–Ό /"), Equals(" D original"), Equals(" A renamed"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/file/stage_deleted_range_select.go
pkg/integration/tests/file/stage_deleted_range_select.go
package file import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var StageDeletedRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stage a range of deleted files using range select", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { }, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file-a", "") shell.CreateFileAndAdd("file-b", "") shell.Commit("first commit") shell.DeleteFile("file-a") shell.DeleteFile("file-b") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Equals(" D file-a"), Equals(" D file-b"), ). SelectNextItem(). // Stage a single deleted file PressPrimaryAction(). Lines( Equals("β–Ό /"), Equals(" D file-a").IsSelected(), Equals(" D file-b"), ). Press(keys.Universal.ToggleRangeSelect). NavigateToLine(Contains("file-b")). // Stage both files while a deleted file is already staged PressPrimaryAction(). Lines( Equals("β–Ό /"), Equals(" D file-a").IsSelected(), Equals(" D file-b").IsSelected(), ). // Unstage; back to everything being unstaged PressPrimaryAction(). Lines( Equals("β–Ό /"), Equals(" D file-a").IsSelected(), Equals(" D file-b").IsSelected(), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/stash/pop.go
pkg/integration/tests/stash/pop.go
package stash import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var Pop = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Pop a stash entry", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.NewBranch("stash") shell.Checkout("master") shell.CreateFile("file", "content") shell.GitAddAll() shell.Stash("stash one") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files().IsEmpty() t.Views().Stash(). Focus(). Lines( Contains("stash one").IsSelected(), ). Press(keys.Stash.PopStash). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Stash pop")). Content(Contains("Are you sure you want to pop this stash entry?")). Confirm() }). IsEmpty() t.Views().Files(). IsFocused(). Lines( Contains("file"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/stash/create_branch.go
pkg/integration/tests/stash/create_branch.go
package stash import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var CreateBranch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Create a branch from a stash entry", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.NewBranch("stash") shell.Checkout("master") shell.CreateFile("myfile", "content") shell.GitAddAll() shell.Stash("stash one") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files().IsEmpty() t.Views().Stash(). Focus(). Lines( Contains("stash one").IsSelected(), ). Press(keys.Universal.New). Tap(func() { t.ExpectPopup().Prompt(). Title(Contains("New branch name (branch is off of 'stash@{0}: On master: stash one'")). Type("new_branch"). Confirm() }) t.Views().Files().IsEmpty() t.Views().Branches(). IsFocused(). Lines( Contains("new_branch").IsSelected(), Contains("master"), Contains("stash"), ). PressEnter() t.Views().SubCommits(). Lines( Contains("On master: stash one").IsSelected(), MatchesRegexp(`index on master:.*initial commit`), Contains("initial commit"), ) t.Views().Main().Content(Contains("myfile | 1 +")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/stash/stash_staged.go
pkg/integration/tests/stash/stash_staged.go
package stash import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var StashStaged = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stash staged changes", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file-staged", "content") shell.CreateFileAndAdd("file-unstaged", "content") shell.EmptyCommit("initial commit") shell.UpdateFileAndAdd("file-staged", "new content") shell.UpdateFile("file-unstaged", "new content") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Stash(). IsEmpty() t.Views().Files(). Lines( Equals("β–Ό /"), Equals(" M file-staged"), Equals(" M file-unstaged"), ). Press(keys.Files.ViewStashOptions) t.ExpectPopup().Menu().Title(Equals("Stash options")).Select(MatchesRegexp("Stash staged changes$")).Confirm() t.ExpectPopup().Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() t.Views().Stash(). Lines( Contains("my stashed file"), ) t.Views().Files(). Lines( Equals(" M file-unstaged"), ) t.Views().Stash(). Focus(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file-staged").IsSelected(), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/stash/show_with_branch_named_stash.go
pkg/integration/tests/stash/show_with_branch_named_stash.go
package stash import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var ShowWithBranchNamedStash = NewIntegrationTest(NewIntegrationTestArgs{ Description: "View stash when there is a branch also named 'stash'", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFile("file", "content") shell.GitAddAll() shell.NewBranch("stash") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Stash(). IsEmpty() t.Views().Files(). Lines( Contains("file"), ). Press(keys.Files.StashAllChanges) t.ExpectPopup().Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() t.Views().Stash(). Lines( MatchesRegexp(`\ds .* my stashed file`), ) t.Views().Files(). IsEmpty() t.Views().Stash().Focus() t.Views().Main().ContainsLines(Equals(" file | 1 +")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/stash/stash_unstaged.go
pkg/integration/tests/stash/stash_unstaged.go
package stash import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var StashUnstaged = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stash unstaged changes", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file-staged", "content") shell.CreateFileAndAdd("file-unstaged", "content") shell.EmptyCommit("initial commit") shell.UpdateFileAndAdd("file-staged", "new content") shell.UpdateFile("file-unstaged", "new content") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Stash(). IsEmpty() t.Views().Files(). Lines( Equals("β–Ό /"), Equals(" M file-staged"), Equals(" M file-unstaged"), ). Press(keys.Files.ViewStashOptions) t.ExpectPopup().Menu().Title(Equals("Stash options")).Select(MatchesRegexp("Stash unstaged changes$")).Confirm() t.ExpectPopup().Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() t.Views().Stash(). Lines( Contains("my stashed file"), ) t.Views().Files(). Lines( Contains("file-staged"), ) t.Views().Stash(). Focus(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file-unstaged").IsSelected(), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/stash/apply.go
pkg/integration/tests/stash/apply.go
package stash import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var Apply = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Apply a stash entry", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.NewBranch("stash") shell.Checkout("master") shell.CreateFile("file", "content") shell.GitAddAll() shell.Stash("stash one") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files().IsEmpty() t.Views().Stash(). Focus(). Lines( Contains("stash one").IsSelected(), ). PressPrimaryAction(). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Stash apply")). Content(Contains("Are you sure you want to apply this stash entry?")). Confirm() }). Lines( Contains("stash one").IsSelected(), ) t.Views().Files(). IsFocused(). Lines( Contains("file"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/stash/prevent_discarding_file_changes.go
pkg/integration/tests/stash/prevent_discarding_file_changes.go
package stash import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var PreventDiscardingFileChanges = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Check that it is not allowed to discard changes to a file of a stash", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFile("file", "content") shell.GitAddAll() shell.Stash("stash one") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files().IsEmpty() t.Views().Stash(). Focus(). Lines( Contains("stash one").IsSelected(), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file").IsSelected(), ). Press(keys.Universal.Remove) t.ExpectPopup().Confirmation(). Title(Equals("Error")). Content(Contains("Changes can only be discarded from local commits")). Confirm() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/stash/drop_multiple.go
pkg/integration/tests/stash/drop_multiple.go
package stash import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DropMultiple = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Drop multiple stash entries", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFileAndAdd("file1", "content1") shell.Stash("stash one") shell.CreateFileAndAdd("file2", "content2") shell.Stash("stash two") shell.CreateFileAndAdd("file3", "content3") shell.Stash("stash three") shell.CreateFileAndAdd("file4", "content4") shell.Stash("stash four") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files().IsEmpty() t.Views().Stash(). Focus(). SelectNextItem(). Lines( Contains("stash four"), Contains("stash three").IsSelected(), Contains("stash two"), Contains("stash one"), ). Press(keys.Universal.RangeSelectDown). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Stash drop")). Content(Contains("Are you sure you want to drop the selected stash entry(ies)?")). Confirm() }). Lines( Contains("stash four"), Contains("stash one"), ) t.Views().Files().IsEmpty() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/stash/drop.go
pkg/integration/tests/stash/drop.go
package stash import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var Drop = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Drop a stash entry", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.NewBranch("stash") shell.Checkout("master") shell.CreateFile("file", "content") shell.GitAddAll() shell.Stash("stash one") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files().IsEmpty() t.Views().Stash(). Focus(). Lines( Contains("stash one").IsSelected(), ). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Stash drop")). Content(Contains("Are you sure you want to drop the selected stash entry(ies)?")). Confirm() }). IsEmpty() t.Views().Files().IsEmpty() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/stash/apply_patch.go
pkg/integration/tests/stash/apply_patch.go
package stash import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var ApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Restore part of a stash entry via applying a custom patch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFile("myfile", "content") shell.CreateFile("myfile2", "content") shell.GitAddAll() shell.Stash("stash one") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files().IsEmpty() t.Views().Stash(). Focus(). Lines( Contains("stash one").IsSelected(), ). PressEnter(). Tap(func() { t.Views().CommitFiles(). IsFocused(). Lines( Equals("β–Ό /").IsSelected(), Contains("myfile"), Contains("myfile2"), ). SelectNextItem(). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) t.Views(). CommitFiles(). Press(keys.Universal.CreatePatchOptionsMenu) t.ExpectPopup().Menu(). Title(Equals("Patch options")). Select(MatchesRegexp(`Apply patch$`)).Confirm() }) t.Views().Files().Lines( Contains("myfile"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/stash/stash.go
pkg/integration/tests/stash/stash.go
package stash import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var Stash = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stashing files directly (not going through the stash menu)", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.NewBranch("stash") shell.Checkout("master") shell.CreateFile("file", "content") shell.GitAddAll() }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Stash(). IsEmpty() t.Views().Files(). Lines( Contains("file"), ). Press(keys.Files.StashAllChanges) t.ExpectPopup().Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() t.Views().Stash(). Lines( MatchesRegexp(`\ds .* my stashed file`), ) t.Views().Files(). IsEmpty() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/stash/rename.go
pkg/integration/tests/stash/rename.go
package stash import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var Rename = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Try to rename the stash.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. EmptyCommit("blah"). NewBranch("stash"). Checkout("master"). CreateFileAndAdd("file-1", "change to stash1"). Stash("foo"). CreateFileAndAdd("file-2", "change to stash2"). Stash("bar") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Stash(). Focus(). Lines( Contains("On master: bar"), Contains("On master: foo"), ). SelectNextItem(). Press(keys.Stash.RenameStash). Tap(func() { t.ExpectPopup().Prompt().Title(Equals("Rename stash: stash@{1}")).Type(" baz").Confirm() }). SelectedLine(Contains("On master: foo baz")) t.Views().Main().Content(Contains("file-1")) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/stash/stash_staged_partial_file.go
pkg/integration/tests/stash/stash_staged_partial_file.go
package stash import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var StashStagedPartialFile = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stash staged changes when a file is partially staged", ExtraCmdArgs: []string{}, GitVersion: AtLeast("git version 2.35.0"), Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file-staged", "line1\nline2\nline3\nline4\n") shell.Commit("initial commit") shell.UpdateFile("file-staged", "line1\nline2 mod\nline3\nline4 mod\n") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). PressEnter() t.Views().Staging(). Content( Contains(" line1\n-line2\n+line2 mod\n line3\n-line4\n+line4 mod"), ). PressPrimaryAction(). Content( Contains(" line1\n line2 mod\n line3\n-line4\n+line4 mod"), ). PressEscape() t.Views().Files(). IsFocused(). Press(keys.Files.ViewStashOptions) t.ExpectPopup().Menu().Title(Equals("Stash options")).Select(MatchesRegexp("Stash staged changes$")).Confirm() t.ExpectPopup().Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() t.Views().Stash(). Focus(). Lines( Contains("my stashed file"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file-staged").IsSelected(), ) t.Views().Main(). Content( Contains(" line1\n-line2\n+line2 mod\n line3\n line4"), ) t.Views().Files(). Focus(). Lines( Contains("file-staged"), ) t.Views().Main(). Content( Contains(" line1\n line2\n line3\n-line4\n+line4 mod"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/stash/stash_all.go
pkg/integration/tests/stash/stash_all.go
package stash import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var StashAll = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stashing all changes (via the menu)", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFile("file", "content") shell.GitAddAll() }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Stash(). IsEmpty() t.Views().Files(). Lines( Contains("file"), ). Press(keys.Files.ViewStashOptions) t.ExpectPopup().Menu().Title(Equals("Stash options")).Select(MatchesRegexp("Stash all changes$")).Confirm() t.ExpectPopup().Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() t.Views().Stash(). Lines( Contains("my stashed file"), ) t.Views().Files(). IsEmpty() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/stash/stash_and_keep_index.go
pkg/integration/tests/stash/stash_and_keep_index.go
package stash import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var StashAndKeepIndex = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stash staged changes", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file-staged", "content") shell.CreateFileAndAdd("file-unstaged", "content") shell.EmptyCommit("initial commit") shell.UpdateFileAndAdd("file-staged", "new content") shell.UpdateFile("file-unstaged", "new content") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Stash(). IsEmpty() t.Views().Files(). Lines( Equals("β–Ό /"), Equals(" M file-staged"), Equals(" M file-unstaged"), ). Press(keys.Files.ViewStashOptions) t.ExpectPopup().Menu().Title(Equals("Stash options")).Select(Contains("Stash all changes and keep index")).Confirm() t.ExpectPopup().Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() t.Views().Stash(). Lines( Contains("my stashed file"), ) t.Views().Files(). Lines( Equals("M file-staged"), ) t.Views().Stash(). Focus(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Equals("β–Ό /"), Equals(" M file-staged"), Equals(" M file-unstaged"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/stash/filter_by_path.go
pkg/integration/tests/stash/filter_by_path.go
package stash import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var FilterByPath = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Filter the stash list by path", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFileAndAdd("file1", "content") shell.Stash("file1") shell.CreateDir("subdir") shell.CreateFileAndAdd("subdir/file2", "content") shell.Stash("subdir/file2") shell.CreateFileAndAdd("file1", "other content") shell.Stash("file1 again") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { filterBy := func(path string) { t.GlobalPress(keys.Universal.FilteringMenu) t.ExpectPopup().Menu(). Title(Equals("Filtering")). Select(Contains("Enter path to filter by")). Confirm() t.ExpectPopup().Prompt(). Title(Equals("Enter path:")). Type(path). Confirm() } t.Views().Stash(). Lines( Contains("file1 again"), Contains("subdir/file2"), Contains("file1"), ) filterBy("file1") t.Views().Stash(). Lines( Contains("file1 again"), Contains("file1"), ) t.GlobalPress(keys.Universal.Return) filterBy("subdir") t.Views().Stash(). Lines( Contains("subdir/file2"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/stash/stash_including_untracked_files.go
pkg/integration/tests/stash/stash_including_untracked_files.go
package stash import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var StashIncludingUntrackedFiles = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stashing all files including untracked ones", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFile("file_1", "content") shell.CreateFile("file_2", "content") shell.GitAdd("file_1") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Stash(). IsEmpty() t.Views().Files(). Lines( Equals("β–Ό /"), Equals(" A file_1"), Equals(" ?? file_2"), ). Press(keys.Files.ViewStashOptions) t.ExpectPopup().Menu().Title(Equals("Stash options")).Select(Contains("Stash all changes including untracked files")).Confirm() t.ExpectPopup().Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() t.Views().Stash(). Lines( Contains("my stashed file"), ) t.Views().Files(). IsEmpty() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/stash/drop_multiple_in_filtered_mode.go
pkg/integration/tests/stash/drop_multiple_in_filtered_mode.go
package stash import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DropMultipleInFilteredMode = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Drop multiple stash entries when filtering by path", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFileAndAdd("file1", "content1") shell.Stash("stash one") shell.CreateFileAndAdd("file2", "content2a") shell.Stash("stash two-a") shell.CreateFileAndAdd("file3", "content3") shell.Stash("stash three") shell.CreateFileAndAdd("file2", "content2b") shell.Stash("stash two-b") shell.CreateFileAndAdd("file4", "content4") shell.Stash("stash four") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Stash(). Lines( Contains("stash four"), Contains("stash two-b"), Contains("stash three"), Contains("stash two-a"), Contains("stash one"), ) t.GlobalPress(keys.Universal.FilteringMenu) t.ExpectPopup().Menu(). Title(Equals("Filtering")). Select(Contains("Enter path to filter by")). Confirm() t.ExpectPopup().Prompt(). Title(Equals("Enter path:")). Type("file2"). Confirm() t.Views().Stash(). Focus(). Lines( Contains("stash two-b").IsSelected(), Contains("stash two-a"), ). Press(keys.Universal.RangeSelectDown). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Stash drop")). Content(Contains("Are you sure you want to drop the selected stash entry(ies)?")). Confirm() }). IsEmpty() t.GlobalPress(keys.Universal.Return) // cancel filtering mode t.Views().Stash(). Lines( Contains("stash four"), Contains("stash three"), Contains("stash one"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/remote/add_fork_remote.go
pkg/integration/tests/remote/add_fork_remote.go
package remote import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var AddForkRemote = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Use the 'Add fork remote' command to add a fork remote and check out a branch from it", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("commit") shell.CloneIntoRemote("origin") shell.NewBranch("feature") shell.Clone("fork") shell.Checkout("master") shell.RemoveBranch("feature") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Remotes(). Focus(). Lines( Contains("origin").IsSelected(), ). Press(keys.Branches.AddForkRemote) t.ExpectPopup().Prompt(). Title(Equals("Fork owner (username/org). Use username:branch to check out a branch")). Type("fork:feature"). Confirm() t.Views().Remotes(). Lines( Contains("origin"), Contains("fork").IsSelected(), ) t.Views().Branches(). IsFocused(). Lines( Contains("feature βœ“"), Contains("master"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/checkout_autostash.go
pkg/integration/tests/branch/checkout_autostash.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var CheckoutAutostash = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Check out a branch that requires performing autostash", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file", "a\n\nb") shell.Commit("add file") shell.UpdateFileAndAdd("file", "a\n\nc") shell.Commit("edit last line") shell.Checkout("HEAD^") shell.UpdateFile("file", "b\n\nb") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). Lines( Contains("file"), ) t.Views().Branches(). Focus(). Lines( MatchesRegexp(`\*.*HEAD`).IsSelected(), Contains("master"), ). NavigateToLine(Contains("master")). PressPrimaryAction() t.ExpectPopup().Confirmation(). Title(Contains("Autostash?")). Content(Contains("You must stash and pop your changes to bring them across. Do this automatically? (enter/esc)")). Confirm() t.Views().Branches(). Lines( Contains("master").IsSelected(), ) t.Git().CurrentBranchName("master") t.Views().Files(). Lines( Contains("file"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/rebase_to_upstream.go
pkg/integration/tests/branch/rebase_to_upstream.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RebaseToUpstream = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Rebase the current branch to the selected branch upstream", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. CloneIntoRemote("origin"). EmptyCommit("ensure-master"). EmptyCommit("to-be-added"). // <- this will only exist remotely PushBranchAndSetUpstream("origin", "master"). RenameCurrentBranch("master-local"). HardReset("HEAD~1"). NewBranchFrom("base-branch", "master-local"). EmptyCommit("base-branch-commit"). NewBranch("target"). EmptyCommit("target-commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits().Lines( Contains("target-commit"), Contains("base-branch-commit"), Contains("ensure-master"), ) t.Views().Branches(). Focus(). Lines( Contains("target").IsSelected(), Contains("base-branch"), Contains("master-local"), ). SelectNextItem(). Lines( Contains("target"), Contains("base-branch").IsSelected(), Contains("master-local"), ). Press(keys.Branches.SetUpstream). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Upstream options")). Select(Contains("Rebase checked-out branch onto upstream of selected branch")). Tooltip(Contains("Disabled: The selected branch has no upstream (or the upstream is not stored locally)")). Confirm(). Tap(func() { t.ExpectToast(Equals("Disabled: The selected branch has no upstream (or the upstream is not stored locally)")) }). Cancel() }). SelectNextItem(). Lines( Contains("target"), Contains("base-branch"), Contains("master-local").IsSelected(), ). Press(keys.Branches.SetUpstream). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Upstream options")). Select(Contains("Rebase checked-out branch onto origin/master...")). Confirm() t.ExpectPopup().Menu(). Title(Equals("Rebase 'target'")). Select(Contains("Simple rebase")). Confirm() }) t.Views().Commits().Lines( Contains("target-commit"), Contains("base-branch-commit"), Contains("to-be-added"), Contains("ensure-master"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/open_pull_request_no_upstream.go
pkg/integration/tests/branch/open_pull_request_no_upstream.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var OpenPullRequestNoUpstream = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Open up a pull request with a missing upstream branch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) {}, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views(). Branches(). Focus(). Press(keys.Branches.CreatePullRequest) t.ExpectPopup().Alert(). Title(Equals("Error")). Content(Contains("Cannot open a pull request for a branch with no upstream")). Confirm() }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/reset.go
pkg/integration/tests/branch/reset.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var Reset = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Hard reset to another branch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.NewBranch("current-branch") shell.EmptyCommit("root commit") shell.NewBranch("other-branch") shell.EmptyCommit("other-branch commit") shell.Checkout("current-branch") shell.EmptyCommit("current-branch commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits().Lines( Contains("current-branch commit"), Contains("root commit"), ) t.Views().Branches(). Focus(). Lines( Contains("current-branch").IsSelected(), Contains("other-branch"), ). SelectNextItem(). Press(keys.Commits.ViewResetOptions) t.ExpectPopup().Menu(). Title(Contains("Reset to other-branch")). Select(Contains("Hard reset")). Confirm() // assert that we now have the expected commits in the commit panel t.Views().Commits(). Lines( Contains("other-branch commit"), Contains("root commit"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/delete_multiple.go
pkg/integration/tests/branch/delete_multiple.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var DeleteMultiple = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Try some combinations of local and remote branch deletions with a range selection of branches", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.LocalBranchSortOrder = "alphabetical" config.GetUserConfig().Git.RemoteBranchSortOrder = "alphabetical" }, SetupRepo: func(shell *Shell) { shell. CloneIntoRemote("origin"). CloneIntoRemote("other-remote"). EmptyCommit("blah"). NewBranch("branch-01"). EmptyCommit("on branch-01 01"). PushBranchAndSetUpstream("origin", "branch-01"). EmptyCommit("on branch-01 02"). NewBranch("branch-02"). EmptyCommit("on branch-02 01"). PushBranchAndSetUpstream("origin", "branch-02"). NewBranchFrom("branch-03", "master"). EmptyCommit("on branch-03 01"). NewBranch("current-head"). EmptyCommit("on current-head"). NewBranchFrom("branch-04", "master"). EmptyCommit("on branch-04 01"). PushBranchAndSetUpstream("other-remote", "branch-04"). EmptyCommit("on branch-04 02"). NewBranchFrom("branch-05", "master"). EmptyCommit("on branch-05 01"). PushBranchAndSetUpstream("origin", "branch-05"). NewBranchFrom("branch-06", "master"). EmptyCommit("on branch-06 01"). PushBranch("origin", "branch-06"). PushBranchAndSetUpstream("other-remote", "branch-06"). EmptyCommit("on branch-06 02"). Checkout("current-head") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( Contains("current-head").IsSelected(), Contains("branch-01 ↑1"), Contains("branch-02 βœ“"), Contains("branch-03"), Contains("branch-04 ↑1"), Contains("branch-05 βœ“"), Contains("branch-06 ↑1"), Contains("master"), ). Press(keys.Universal.RangeSelectDown). // Deleting a range that includes the current branch is not possible Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup(). Menu(). Tooltip(Contains("You cannot delete the checked out branch!")). Title(Equals("Delete selected branches?")). Select(Contains("Delete local branches")). Confirm(). Tap(func() { t.ExpectToast(Contains("You cannot delete the checked out branch!")) }). Cancel() }). // Delete branch-03 and branch-04. 04 is not fully merged, so we get // a confirmation popup. NavigateToLine(Contains("branch-03")). Press(keys.Universal.RangeSelectDown). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup(). Menu(). Title(Equals("Delete selected branches?")). Select(Contains("Delete local branches")). Confirm() t.ExpectPopup(). Confirmation(). Title(Equals("Force delete branch")). Content(Equals("Some of the selected branches are not fully merged. Are you sure you want to delete them?")). Confirm() }). Lines( Contains("current-head"), Contains("branch-01 ↑1"), Contains("branch-02 βœ“"), Contains("branch-05 βœ“").IsSelected(), Contains("branch-06 ↑1"), Contains("master"), ). // Delete remote branches of branch-05 and branch-06. They are on different remotes. NavigateToLine(Contains("branch-05")). Press(keys.Universal.RangeSelectDown). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup(). Menu(). Title(Equals("Delete selected branches?")). Select(Contains("Delete remote branches")). Confirm() }). Tap(func() { t.ExpectPopup(). Confirmation(). Title(Equals("Delete selected branches?")). Content(Equals("Are you sure you want to delete the remote branches of the selected branches from their respective remotes?")). Confirm() }). Tap(func() { checkRemoteBranches(t, keys, "origin", []string{ "branch-01", "branch-02", "branch-06", }) checkRemoteBranches(t, keys, "other-remote", []string{ "branch-04", }) }). Lines( Contains("current-head"), Contains("branch-01 ↑1"), Contains("branch-02 βœ“"), Contains("branch-05 (upstream gone)").IsSelected(), Contains("branch-06 (upstream gone)").IsSelected(), Contains("master"), ). // Try to delete both local and remote branches of branch-02 and // branch-05; not possible because branch-05's upstream is gone Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup(). Menu(). Title(Equals("Delete selected branches?")). Select(Contains("Delete local and remote branches")). Confirm(). Tap(func() { t.ExpectToast(Contains("Some of the selected branches have no upstream (or the upstream is not stored locally)")) }). Cancel() }). // Delete both local and remote branches of branch-01 and branch-02. We get // the force-delete warning because branch-01 it is not fully merged. NavigateToLine(Contains("branch-01")). Press(keys.Universal.RangeSelectDown). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup(). Menu(). Title(Equals("Delete selected branches?")). Select(Contains("Delete local and remote branches")). Confirm() t.ExpectPopup(). Confirmation(). Title(Equals("Delete local and remote branch")). Content(Contains("Are you sure you want to delete both the selected branches from your machine, and their remote branches from their respective remotes?"). Contains("Some of the selected branches are not fully merged. Are you sure you want to delete them?")). Confirm() }). Lines( Contains("current-head"), Contains("branch-05 (upstream gone)").IsSelected(), Contains("branch-06 (upstream gone)"), Contains("master"), ). Tap(func() { checkRemoteBranches(t, keys, "origin", []string{ "branch-06", }) checkRemoteBranches(t, keys, "other-remote", []string{ "branch-04", }) }) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/move_commits_to_new_branch_from_base_branch.go
pkg/integration/tests/branch/move_commits_to_new_branch_from_base_branch.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var MoveCommitsToNewBranchFromBaseBranch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Create a new branch from the commits that you accidentally made on the wrong branch; choosing base branch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CloneIntoRemote("origin") shell.PushBranchAndSetUpstream("origin", "master") shell.NewBranch("feature") shell.EmptyCommit("feature branch commit") shell.PushBranchAndSetUpstream("origin", "feature") shell.CreateFileAndAdd("file1", "file1 content") shell.Commit("new commit 1") shell.EmptyCommit("new commit 2") shell.UpdateFile("file1", "file1 changed") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). Lines( Contains("M file1"), ) t.Views().Branches(). Focus(). Lines( Contains("feature ↑2").IsSelected(), Contains("master βœ“"), ). Press(keys.Branches.MoveCommitsToNewBranch) t.ExpectPopup().Menu(). Title(Equals("Move commits to new branch")). Select(Contains("New branch from base branch (origin/master)")). Confirm() t.ExpectPopup().Prompt(). Title(Equals("New branch name (branch is off of 'origin/master')")). Type("new branch"). Confirm() t.Views().Branches(). Lines( Contains("new-branch").DoesNotContain("↑").IsSelected(), Contains("feature βœ“"), Contains("master βœ“"), ) t.Views().Commits(). Lines( Contains("new commit 2").IsSelected(), Contains("new commit 1"), Contains("initial commit"), ) t.Views().Files(). Lines( Contains("M file1"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/rebase_copied_branch.go
pkg/integration/tests/branch/rebase_copied_branch.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var RebaseCopiedBranch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Make a copy of a branch, rebase it, check that the original branch is unaffected", ExtraCmdArgs: []string{}, Skip: false, GitVersion: AtLeast("2.38.0"), SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.Log.ShowGraph = "never" }, SetupRepo: func(shell *Shell) { shell. EmptyCommit("master 1"). EmptyCommit("master 2"). NewBranchFrom("branch1", "master^"). EmptyCommit("branch 1"). EmptyCommit("branch 2"). NewBranch("branch2") shell.SetConfig("rebase.updateRefs", "true") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits().Lines( Contains("CI * branch 2"), Contains("CI branch 1"), Contains("CI master 1"), ) t.Views().Branches(). Focus(). Lines( Contains("branch2").IsSelected(), Contains("branch1"), Contains("master"), ). NavigateToLine(Contains("master")). Press(keys.Branches.RebaseBranch). Tap(func() { t.ExpectPopup().Menu(). Title(Equals("Rebase 'branch2'")). Select(Contains("Simple rebase")). Confirm() }) t.Views().Commits().Lines( Contains("CI branch 2"), Contains("CI branch 1"), Contains("CI master 2"), Contains("CI master 1"), ) t.Views().Branches(). Focus(). NavigateToLine(Contains("branch1")). PressPrimaryAction() t.Views().Commits().Lines( Contains("CI branch 2"), Contains("CI branch 1"), Contains("CI master 1"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/new_branch_with_prefix.go
pkg/integration/tests/branch/new_branch_with_prefix.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) var NewBranchWithPrefix = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Creating a new branch from a commit with a default name", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(cfg *config.AppConfig) { cfg.GetUserConfig().Git.BranchPrefix = "myprefix/" }, SetupRepo: func(shell *Shell) { shell. EmptyCommit("commit 1") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("commit 1").IsSelected(), ). SelectNextItem(). Press(keys.Universal.New). Tap(func() { branchName := "my-branch-name" t.ExpectPopup().Prompt().Title(Contains("New branch name")).Type(branchName).Confirm() t.Git().CurrentBranchName("myprefix/" + branchName) }) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/branch/rebase_cancel_on_conflict.go
pkg/integration/tests/branch/rebase_cancel_on_conflict.go
package branch import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" "github.com/jesseduffield/lazygit/pkg/integration/tests/shared" ) var RebaseCancelOnConflict = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Rebase onto another branch, cancel when there are conflicts.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.LocalBranchSortOrder = "recency" }, SetupRepo: func(shell *Shell) { shared.MergeConflictsSetup(shell) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits().TopLines( Contains("first change"), Contains("original"), ) t.Views().Branches(). Focus(). Lines( Contains("first-change-branch"), Contains("second-change-branch"), Contains("original-branch"), ). SelectNextItem(). Press(keys.Branches.RebaseBranch) t.ExpectPopup().Menu(). Title(Equals("Rebase 'first-change-branch'")). Select(Contains("Simple rebase")). Confirm() t.ExpectPopup().Menu(). Title(Equals("Conflicts!")). Select(Contains("Abort the rebase")). Cancel() t.Views().Branches(). IsFocused() t.Views().Files(). Lines( Contains("UU file"), ) }, })
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false