mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-21 00:30:00 +02: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:
pkg
app
commands
git.gogit_cmd_obj_builder.go
git_commands
bisect.gobranch.gobranch_test.gocommit.gocommit_file_loader.gocommit_loader.gocommit_loader_test.gocommit_test.gocustom.godiff.gofile.gofile_loader.gofile_loader_test.gofile_test.goflow.goflow_test.gogit_command_builder.gogit_command_builder_test.gopatch.gopatch_test.gorebase.gorebase_test.goreflog_commit_loader.goreflog_commit_loader_test.goremote.goremote_loader.gostash.gostash_loader.gostash_loader_test.gostash_test.gostatus.gosubmodule.gosync.gosync_test.gotag.gotag_loader.gotag_loader_test.goversion.goworking_tree.goworking_tree_test.go
oscommands
gui
controllers
integration
components
tests
bisect
branch
checkout_by_name.gocreate_tag.godelete.godetached_head.goopen_with_cli_arg.gorebase.gorebase_and_drop.gorebase_does_not_autosquash.goreset.goreset_upstream.goset_upstream.gosuggestions.go
cherry_pick
commit
amend.gocommit.gocommit_multiline.gocommit_wip_with_prefix.gocommit_with_prefix.gocreate_tag.godiscard_old_file_change.gohistory.gohistory_complex.gonew_branch.goreset_author.gorevert.gorevert_merge.goreword.gosearch.goset_author.gostage_range_of_lines.gostaged.gostaged_without_hooks.gounstaged.go
config
conflicts
custom_commands
basic_cmd_at_runtime.gobasic_cmd_from_config.gocomplex_cmd_at_runtime.goform_prompts.gomenu_from_command.gomenu_from_commands_output.gomultiple_prompts.goomit_from_history.go
diff
file
dir_with_untracked_file.godiscard_changes.godiscard_staged_changes.gogitignore.goremember_commit_message_after_fail.go
filter_by_path
interactive_rebase
advanced_interactive_rebase.goamend_first_commit.goamend_fixup_commit.goamend_head_commit_during_rebase.goamend_merge.goamend_non_head_commit_during_rebase.godrop_todo_commit_with_update_ref.godrop_todo_commit_with_update_ref_show_branch_heads.goedit_first_commit.goedit_non_todo_commit_during_rebase.gofixup_first_commit.gofixup_second_commit.gomove.gomove_in_rebase.gorebase.goreword_first_commit.goreword_last_commit.goreword_you_are_here_commit.goreword_you_are_here_commit_with_editor.gosquash_down_first_commit.gosquash_down_second_commit.gosquash_fixups_above_first_commit.goswap_in_rebase_with_conflict.goswap_with_conflict.go
misc
patch_building
apply.goapply_in_reverse.goapply_in_reverse_with_conflict.gocopy_patch_to_clipboard.gomove_to_earlier_commit.gomove_to_earlier_commit_no_keep_empty.gomove_to_index.gomove_to_index_part_of_adjacent_added_lines.gomove_to_index_partial.gomove_to_index_with_conflict.gomove_to_later_commit.gomove_to_later_commit_partial_hunk.gomove_to_new_commit.gomove_to_new_commit_partial_hunk.goremove_from_commit.goreset_with_escape.goselect_all_files.gospecific_selection.gostart_new_patch.go
reflog
shared
staging
stash
apply.goapply_patch.gocreate_branch.godrop.gopop.gorename.gostash.gostash_all.gostash_and_keep_index.gostash_including_untracked_files.gostash_staged.gostash_unstaged.go
submodule
sync
fetch_prune.goforce_push.goforce_push_multiple_matching.goforce_push_multiple_upstream.gopull.gopull_and_set_upstream.gopull_merge.gopull_merge_conflict.gopull_rebase.gopull_rebase_conflict.gopull_rebase_interactive_conflict.gopull_rebase_interactive_conflict_drop.gopush.gopush_and_auto_set_upstream.gopush_and_set_upstream.gopush_follow_tags.gopush_no_follow_tags.gopush_tag.gopush_with_credential_prompt.gorename_branch_and_pull.go
tag
test_list.goui
undo
updates
@ -49,13 +49,13 @@ func (self *FlowCommands) FinishCmdObj(branchName string) (oscommands.ICmdObj, e
|
||||
return nil, errors.New(self.Tr.NotAGitFlowBranch)
|
||||
}
|
||||
|
||||
cmdStr := NewGitCmd("flow").Arg(branchType, "finish", suffix).ToString()
|
||||
cmdArgs := NewGitCmd("flow").Arg(branchType, "finish", suffix).ToArgv()
|
||||
|
||||
return self.cmd.New(cmdStr), nil
|
||||
return self.cmd.New(cmdArgs), nil
|
||||
}
|
||||
|
||||
func (self *FlowCommands) StartCmdObj(branchType string, name string) oscommands.ICmdObj {
|
||||
cmdStr := NewGitCmd("flow").Arg(branchType, "start", name).ToString()
|
||||
cmdArgs := NewGitCmd("flow").Arg(branchType, "start", name).ToArgv()
|
||||
|
||||
return self.cmd.New(cmdStr)
|
||||
return self.cmd.New(cmdArgs)
|
||||
}
|
||||
|
Reference in New Issue
Block a user