Refactor git command arguments and make all arguments to be safe to be used (#21535)
Follow #21464 Make all git command arguments strictly safe. Most changes are one-to-one replacing, keep all existing logic.
This commit is contained in:
parent
4eeea7b30e
commit
dcd9fc7ee8
71 changed files with 425 additions and 391 deletions
|
@ -44,7 +44,7 @@ func verifyCommits(oldCommitID, newCommitID string, repo *git.Repository, env []
|
|||
}()
|
||||
|
||||
// This is safe as force pushes are already forbidden
|
||||
err = git.NewCommand(repo.Ctx, "rev-list", oldCommitID+"..."+newCommitID).
|
||||
err = git.NewCommand(repo.Ctx, "rev-list").AddDynamicArguments(oldCommitID + "..." + newCommitID).
|
||||
Run(&git.RunOpts{
|
||||
Env: env,
|
||||
Dir: repo.Path,
|
||||
|
@ -91,7 +91,7 @@ func readAndVerifyCommit(sha string, repo *git.Repository, env []string) error {
|
|||
}()
|
||||
hash := git.MustIDFromString(sha)
|
||||
|
||||
return git.NewCommand(repo.Ctx, "cat-file", "commit", sha).
|
||||
return git.NewCommand(repo.Ctx, "cat-file", "commit").AddDynamicArguments(sha).
|
||||
Run(&git.RunOpts{
|
||||
Env: env,
|
||||
Dir: repo.Path,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue