mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-09 09:22:48 +03:00
Construct arg vector manually rather than parse string
By constructing an arg vector manually, we no longer need to quote arguments Mandate that args must be passed when building a command Now you need to provide an args array when building a command. There are a handful of places where we need to deal with a string, such as with user-defined custom commands, and for those we now require that at the callsite they use str.ToArgv to do that. I don't want to provide a method out of the box for it because I want to discourage its use. For some reason we were invoking a command through a shell when amending a commit, and I don't believe we needed to do that as there was nothing user- supplied about the command. So I've switched to using a regular command out- side the shell there
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
var Apply = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Apply a custom patch",
|
||||
ExtraCmdArgs: "",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
var ApplyInReverse = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Apply a custom patch in reverse",
|
||||
ExtraCmdArgs: "",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
var ApplyInReverseWithConflict = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Apply a custom patch in reverse, resulting in a conflict",
|
||||
ExtraCmdArgs: "",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
var CopyPatchToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Create a patch from the commits and copy the patch to clipbaord.",
|
||||
ExtraCmdArgs: "",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: true, // skipping because CI doesn't have clipboard functionality
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
var MoveToEarlierCommit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Move a patch from a commit to an earlier commit",
|
||||
ExtraCmdArgs: "",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
GitVersion: AtLeast("2.26.0"),
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
var MoveToEarlierCommitNoKeepEmpty = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Move a patch from a commit to an earlier commit, for older git versions that don't keep the empty commit",
|
||||
ExtraCmdArgs: "",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
GitVersion: Before("2.26.0"),
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
var MoveToIndex = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Move a patch from a commit to the index",
|
||||
ExtraCmdArgs: "",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
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: "",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
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: "",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
var MoveToIndexWithConflict = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Move a patch from a commit to the index, causing a conflict",
|
||||
ExtraCmdArgs: "",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
var MoveToLaterCommit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Move a patch from a commit to a later commit",
|
||||
ExtraCmdArgs: "",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
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: "",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
var MoveToNewCommit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Move a patch from a commit to a new commit",
|
||||
ExtraCmdArgs: "",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
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: "",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
var RemoveFromCommit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Remove a custom patch from a commit",
|
||||
ExtraCmdArgs: "",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
var ResetWithEscape = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Reset a custom patch with the escape keybinding",
|
||||
ExtraCmdArgs: "",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
var SelectAllFiles = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "All all files of a commit to a custom patch with the 'a' keybinding",
|
||||
ExtraCmdArgs: "",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
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: "",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
var StartNewPatch = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Attempt to add a file from another commit to a patch, then agree to start a new patch",
|
||||
ExtraCmdArgs: "",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
|
Reference in New Issue
Block a user