зеркало из https://github.com/go-gitea/git.git
command: fix NewCommand (#135)
Make an explicit copy of GlobalCommandArgs, otherwise append might overwrite it.
This commit is contained in:
Родитель
6b819173ed
Коммит
389d3c803e
|
@ -37,9 +37,12 @@ func (c *Command) String() string {
|
|||
|
||||
// NewCommand creates and returns a new Git Command based on given command and arguments.
|
||||
func NewCommand(args ...string) *Command {
|
||||
// Make an explicit copy of GlobalCommandArgs, otherwise append might overwrite it
|
||||
cargs := make([]string, len(GlobalCommandArgs))
|
||||
copy(cargs, GlobalCommandArgs)
|
||||
return &Command{
|
||||
name: "git",
|
||||
args: append(GlobalCommandArgs, args...),
|
||||
args: append(cargs, args...),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче