Follow #21464 Make all git command arguments strictly safe. Most changes are one-to-one replacing, keep all existing logic.