1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-28 16:02:01 +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:
Jesse Duffield
2023-05-21 17:00:29 +10:00
parent 70e473b25d
commit 63dc07fded
221 changed files with 1050 additions and 885 deletions

View File

@ -16,7 +16,7 @@ const (
var AdvancedInteractiveRebase = NewIntegrationTest(NewIntegrationTestArgs{
Description: "It begins an interactive rebase and verifies to have the possibility of editing the commits of the branch before proceeding with the actual rebase",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.

View File

@ -7,7 +7,7 @@ import (
var AmendFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Amends a staged file to the first (initial) commit.",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var AmendFixupCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Amends a staged file to a fixup commit, and checks that other unrelated fixup commits are not auto-squashed.",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var AmendHeadCommitDuringRebase = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Amends the current head commit from the commits panel during a rebase.",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -12,7 +12,7 @@ var (
var AmendMerge = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Amends a staged file to a merge commit.",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var AmendNonHeadCommitDuringRebase = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Tries to amend a commit that is not the head while already rebasing, resulting in an error message",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var DropTodoCommitWithUpdateRef = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Drops a commit during interactive rebase when there is an update-ref in the git-rebase-todo file",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
GitVersion: AtLeast("2.38.0"),
SetupConfig: func(config *config.AppConfig) {},

View File

@ -7,7 +7,7 @@ import (
var DropTodoCommitWithUpdateRefShowBranchHeads = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Drops a commit during interactive rebase when there is an update-ref in the git-rebase-todo file (with experimentalShowBranchHeads on)",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
GitVersion: AtLeast("2.38.0"),
SetupConfig: func(config *config.AppConfig) {

View File

@ -7,7 +7,7 @@ import (
var EditFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Edits the first commit, just to show that it's possible",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var EditNonTodoCommitDuringRebase = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Tries to edit a non-todo commit while already rebasing, resulting in an error message",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var FixupFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Tries to fixup the first commit, which results in an error message",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var FixupSecondCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Fixup the second commit into the first (initial)",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var Move = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Directly move a commit all the way down and all the way back up",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var MoveInRebase = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Via a single interactive rebase move a commit all the way up then back down then slightly back up again and apply the change",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var Rebase = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Begins an interactive rebase, then fixups, drops, and squashes some commits",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -10,7 +10,7 @@ import (
var RewordFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Rewords the first commit, just to show that it's possible",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var RewordLastCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Rewords the last (HEAD) commit",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var RewordYouAreHereCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Rewords the current HEAD commit in an interactive rebase",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var RewordYouAreHereCommitWithEditor = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Rewords the current HEAD commit in an interactive rebase with editor",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},

View File

@ -7,7 +7,7 @@ import (
var SquashDownFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Tries to squash down the first commit, which results in an error message",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var SquashDownSecondCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Squash down the second commit into the first (initial)",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var SquashFixupsAboveFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Squashes all fixups above the first (initial) commit.",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var SwapInRebaseWithConflict = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Via an edit-triggered rebase, swap two commits, causing a conflict. Then resolve the conflict and continue",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var SwapWithConflict = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Directly swap two commits, causing a conflict. Then resolve the conflict and continue",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {