]> source.dussan.org Git - gitea.git/commit
Refactor merge/update git command calls (#23366)
authorwxiaoguang <wxiaoguang@gmail.com>
Thu, 9 Mar 2023 15:48:52 +0000 (23:48 +0800)
committerGitHub <noreply@github.com>
Thu, 9 Mar 2023 15:48:52 +0000 (09:48 -0600)
commit542cec98f8c07e0f046a35f1d516807416536e74
tree31a6811704630fb6f057aac2193bf1f510daf19e
parente52ac62d8e645c721060e6c9a2b0ab77eedf8fd6
Refactor merge/update git command calls (#23366)

Follow #22568

* Remove unnecessary ToTrustedCmdArgs calls
    * the FAQ in  #22678
* Quote: When using ToTrustedCmdArgs, the code will be very complex (see
the changes for examples). Then developers and reviewers can know that
something might be unreasonable.
* The `signArg` couldn't be empty, it's either `-S{keyID}` or
`--no-gpg-sign`.
* Use `signKeyID` instead, add comment "empty for no-sign, non-empty to
sign"
* 5-line code could be extracted to a common `NewGitCommandCommit()` to
handle the `signKeyID`, but I think it's not a must, current code is
clear enough.
modules/git/command.go
services/pull/merge.go
services/pull/merge_prepare.go
services/pull/merge_squash.go