summaryrefslogtreecommitdiffstats
path: root/modules/git/repo.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-11-27 08:35:52 +0800
committerAntoine GIRARD <sapk@users.noreply.github.com>2019-11-27 01:35:52 +0100
commit7b7d382b8b414e7da67dfec7c7e1ef9e0e269d68 (patch)
treeea2bd9ccb5ba69da61fbf463c4f87409e98307b7 /modules/git/repo.go
parent9d9e6ac4117b8efd2f85fc625a4ccfdcf73c4fc3 (diff)
downloadgitea-7b7d382b8b414e7da67dfec7c7e1ef9e0e269d68.tar.gz
gitea-7b7d382b8b414e7da67dfec7c7e1ef9e0e269d68.zip
Fix datarace on git.GlobalCommandArgs on tests (#9162)
* fix datarace on git.GlobalCommandArgs on tests * fix tests * fix tests * fix tests
Diffstat (limited to 'modules/git/repo.go')
-rw-r--r--modules/git/repo.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/git/repo.go b/modules/git/repo.go
index ffca2524be..e277f896bf 100644
--- a/modules/git/repo.go
+++ b/modules/git/repo.go
@@ -165,12 +165,19 @@ type CloneRepoOptions struct {
// Clone clones original repository to target path.
func Clone(from, to string, opts CloneRepoOptions) (err error) {
+ cargs := make([]string, len(GlobalCommandArgs))
+ copy(cargs, GlobalCommandArgs)
+ return CloneWithArgs(from, to, cargs, opts)
+}
+
+// CloneWithArgs original repository to target path.
+func CloneWithArgs(from, to string, args []string, opts CloneRepoOptions) (err error) {
toDir := path.Dir(to)
if err = os.MkdirAll(toDir, os.ModePerm); err != nil {
return err
}
- cmd := NewCommand("clone")
+ cmd := NewCommandNoGlobals(args...).AddArguments("clone")
if opts.Mirror {
cmd.AddArguments("--mirror")
}