aboutsummaryrefslogtreecommitdiffstats
path: root/integrations/git_test.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 /integrations/git_test.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 'integrations/git_test.go')
-rw-r--r--integrations/git_test.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/integrations/git_test.go b/integrations/git_test.go
index f6137a947a..3ca4cc54c2 100644
--- a/integrations/git_test.go
+++ b/integrations/git_test.go
@@ -148,8 +148,8 @@ func lfsCommitAndPushTest(t *testing.T, dstPath string) (littleLFS, bigLFS strin
assert.NoError(t, err)
err = git.AddChanges(dstPath, false, ".gitattributes")
assert.NoError(t, err)
- oldGlobals := allowLFSFilters()
- err = git.CommitChanges(dstPath, git.CommitChangesOptions{
+
+ err = git.CommitChangesWithArgs(dstPath, allowLFSFilters(), git.CommitChangesOptions{
Committer: &git.Signature{
Email: "user2@example.com",
Name: "User Two",
@@ -163,7 +163,6 @@ func lfsCommitAndPushTest(t *testing.T, dstPath string) (littleLFS, bigLFS strin
Message: fmt.Sprintf("Testing commit @ %v", time.Now()),
})
assert.NoError(t, err)
- git.GlobalCommandArgs = oldGlobals
littleLFS, bigLFS = commitAndPushTest(t, dstPath, prefix)
@@ -307,12 +306,12 @@ func generateCommitWithNewData(size int, repoPath, email, fullName, prefix strin
//Commit
// Now here we should explicitly allow lfs filters to run
- oldGlobals := allowLFSFilters()
- err = git.AddChanges(repoPath, false, filepath.Base(tmpFile.Name()))
+ globalArgs := allowLFSFilters()
+ err = git.AddChangesWithArgs(repoPath, globalArgs, false, filepath.Base(tmpFile.Name()))
if err != nil {
return "", err
}
- err = git.CommitChanges(repoPath, git.CommitChangesOptions{
+ err = git.CommitChangesWithArgs(repoPath, globalArgs, git.CommitChangesOptions{
Committer: &git.Signature{
Email: email,
Name: fullName,
@@ -325,7 +324,6 @@ func generateCommitWithNewData(size int, repoPath, email, fullName, prefix strin
},
Message: fmt.Sprintf("Testing commit @ %v", time.Now()),
})
- git.GlobalCommandArgs = oldGlobals
return filepath.Base(tmpFile.Name()), err
}