summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-05-21 17:00:29 +1000
committerJesse Duffield <jessedduffield@gmail.com>2023-05-23 19:49:19 +1000
commit63dc07fdedec58ae5836a601d9c8839d0481eda6 (patch)
treee49ce7cf9284ebebfd9d4f4d87311418a8993913
parent70e473b25d05d94f07c9d5c7751aaf826e7ad08d (diff)
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
-rw-r--r--pkg/app/app.go2
-rw-r--r--pkg/commands/git.go5
-rw-r--r--pkg/commands/git_cmd_obj_builder.go8
-rw-r--r--pkg/commands/git_commands/bisect.go22
-rw-r--r--pkg/commands/git_commands/branch.go96
-rw-r--r--pkg/commands/git_commands/branch_test.go47
-rw-r--r--pkg/commands/git_commands/commit.go110
-rw-r--r--pkg/commands/git_commands/commit_file_loader.go6
-rw-r--r--pkg/commands/git_commands/commit_loader.go83
-rw-r--r--pkg/commands/git_commands/commit_loader_test.go48
-rw-r--r--pkg/commands/git_commands/commit_test.go63
-rw-r--r--pkg/commands/git_commands/custom.go4
-rw-r--r--pkg/commands/git_commands/diff.go19
-rw-r--r--pkg/commands/git_commands/file.go2
-rw-r--r--pkg/commands/git_commands/file_loader.go6
-rw-r--r--pkg/commands/git_commands/file_loader_test.go13
-rw-r--r--pkg/commands/git_commands/file_test.go6
-rw-r--r--pkg/commands/git_commands/flow.go8
-rw-r--r--pkg/commands/git_commands/flow_test.go16
-rw-r--r--pkg/commands/git_commands/git_command_builder.go6
-rw-r--r--pkg/commands/git_commands/git_command_builder_test.go36
-rw-r--r--pkg/commands/git_commands/patch.go12
-rw-r--r--pkg/commands/git_commands/patch_test.go24
-rw-r--r--pkg/commands/git_commands/rebase.go26
-rw-r--r--pkg/commands/git_commands/rebase_test.go24
-rw-r--r--pkg/commands/git_commands/reflog_commit_loader.go14
-rw-r--r--pkg/commands/git_commands/reflog_commit_loader_test.go10
-rw-r--r--pkg/commands/git_commands/remote.go48
-rw-r--r--pkg/commands/git_commands/remote_loader.go4
-rw-r--r--pkg/commands/git_commands/stash.go74
-rw-r--r--pkg/commands/git_commands/stash_loader.go8
-rw-r--r--pkg/commands/git_commands/stash_loader_test.go5
-rw-r--r--pkg/commands/git_commands/stash_test.go10
-rw-r--r--pkg/commands/git_commands/status.go2
-rw-r--r--pkg/commands/git_commands/submodule.go88
-rw-r--r--pkg/commands/git_commands/sync.go48
-rw-r--r--pkg/commands/git_commands/sync_test.go10
-rw-r--r--pkg/commands/git_commands/tag.go30
-rw-r--r--pkg/commands/git_commands/tag_loader.go4
-rw-r--r--pkg/commands/git_commands/tag_loader_test.go4
-rw-r--r--pkg/commands/git_commands/version.go2
-rw-r--r--pkg/commands/git_commands/working_tree.go103
-rw-r--r--pkg/commands/git_commands/working_tree_test.go54
-rw-r--r--pkg/commands/oscommands/cmd_obj.go26
-rw-r--r--pkg/commands/oscommands/cmd_obj_builder.go30
-rw-r--r--pkg/commands/oscommands/cmd_obj_test.go33
-rw-r--r--pkg/commands/oscommands/fake_cmd_obj_runner.go14
-rw-r--r--pkg/commands/oscommands/os.go15
-rw-r--r--pkg/commands/oscommands/os_default_test.go10
-rw-r--r--pkg/commands/oscommands/os_test.go8
-rw-r--r--pkg/gui/controllers/helpers/diff_helper.go22
-rw-r--r--pkg/gui/controllers/helpers/gpg_helper.go5
-rw-r--r--pkg/gui/controllers/helpers/mode_helper.go3
-rw-r--r--pkg/gui/controllers/local_commits_controller.go2
-rw-r--r--pkg/integration/components/git.go10
-rw-r--r--pkg/integration/components/runner.go15
-rw-r--r--pkg/integration/components/shell.go156
-rw-r--r--pkg/integration/components/test.go6
-rw-r--r--pkg/integration/tests/bisect/basic.go2
-rw-r--r--pkg/integration/tests/bisect/from_other_branch.go4
-rw-r--r--pkg/integration/tests/branch/checkout_by_name.go2
-rw-r--r--pkg/integration/tests/branch/create_tag.go2
-rw-r--r--pkg/integration/tests/branch/delete.go2
-rw-r--r--pkg/integration/tests/branch/detached_head.go2
-rw-r--r--pkg/integration/tests/branch/open_with_cli_arg.go2
-rw-r--r--pkg/integration/tests/branch/rebase.go2
-rw-r--r--pkg/integration/tests/branch/rebase_and_drop.go2
-rw-r--r--pkg/integration/tests/branch/rebase_does_not_autosquash.go2
-rw-r--r--pkg/integration/tests/branch/reset.go2
-rw-r--r--pkg/integration/tests/branch/reset_upstream.go2
-rw-r--r--pkg/integration/tests/branch/set_upstream.go2
-rw-r--r--pkg/integration/tests/branch/suggestions.go2
-rw-r--r--pkg/integration/tests/cherry_pick/cherry_pick.go2
-rw-r--r--pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go2
-rw-r--r--pkg/integration/tests/commit/amend.go2
-rw-r--r--pkg/integration/tests/commit/commit.go2
-rw-r--r--pkg/integration/tests/commit/commit_multiline.go2
-rw-r--r--pkg/integration/tests/commit/commit_wip_with_prefix.go2
-rw-r--r--pkg/integration/tests/commit/commit_with_prefix.go2
-rw-r--r--pkg/integration/tests/commit/create_tag.go2
-rw-r--r--pkg/integration/tests/commit/discard_old_file_change.go2
-rw-r--r--pkg/integration/tests/commit/history.go2
-rw-r--r--pkg/integration/tests/commit/history_complex.go2
-rw-r--r--pkg/integration/tests/commit/new_branch.go2
-rw-r--r--pkg/integration/tests/commit/reset_author.go2
-rw-r--r--pkg/integration/tests/commit/revert.go2
-rw-r--r--pkg/integration/tests/commit/revert_merge.go2
-rw-r--r--pkg/integration/tests/commit/reword.go2
-rw-r--r--pkg/integration/tests/commit/search.go2
-rw-r--r--pkg/integration/tests/commit/set_author.go2
-rw-r--r--pkg/integration/tests/commit/stage_range_of_lines.go2
-rw-r--r--pkg/integration/tests/commit/staged.go2
-rw-r--r--pkg/integration/tests/commit/staged_without_hooks.go2
-rw-r--r--pkg/integration/tests/commit/unstaged.go2
-rw-r--r--pkg/integration/tests/config/remote_named_star.go2
-rw-r--r--pkg/integration/tests/conflicts/filter.go2
-rw-r--r--pkg/integration/tests/conflicts/resolve_externally.go2
-rw-r--r--pkg/integration/tests/conflicts/resolve_multiple_files.go2
-rw-r--r--pkg/integration/tests/conflicts/undo_choose_hunk.go2
-rw-r--r--pkg/integration/tests/custom_commands/basic_cmd_at_runtime.go2
-rw-r--r--pkg/integration/tests/custom_commands/basic_cmd_from_config.go2
-rw-r--r--pkg/integration/tests/custom_commands/complex_cmd_at_runtime.go35
-rw-r--r--pkg/integration/tests/custom_commands/form_prompts.go2
-rw-r--r--pkg/integration/tests/custom_commands/menu_from_command.go2
-rw-r--r--pkg/integration/tests/custom_commands/menu_from_commands_output.go2
-rw-r--r--pkg/integration/tests/custom_commands/multiple_prompts.go2
-rw-r--r--pkg/integration/tests/custom_commands/omit_from_history.go2
-rw-r--r--pkg/integration/tests/diff/diff.go2
-rw-r--r--pkg/integration/tests/diff/diff_and_apply_patch.go2
-rw-r--r--pkg/integration/tests/diff/diff_commits.go2
-rw-r--r--pkg/integration/tests/diff/ignore_whitespace.go2
-rw-r--r--pkg/inte