diff options
author | 6543 <6543@obermui.de> | 2022-01-25 19:15:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-25 18:15:58 +0000 |
commit | 80adbebbc8e0814d0fa0ac660d5c9452e458067b (patch) | |
tree | 50711b3b3760008b7b06abb22b452f2a12730dd2 /integrations/git_helper_for_declarative_test.go | |
parent | 93250bfe278f46f0344f513a13b1b396eddb7406 (diff) | |
download | gitea-80adbebbc8e0814d0fa0ac660d5c9452e458067b.tar.gz gitea-80adbebbc8e0814d0fa0ac660d5c9452e458067b.zip |
Unexport git.GlobalCommandArgs (#18376)
Unexport the git.GlobalCommandArgs variable.
Diffstat (limited to 'integrations/git_helper_for_declarative_test.go')
-rw-r--r-- | integrations/git_helper_for_declarative_test.go | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/integrations/git_helper_for_declarative_test.go b/integrations/git_helper_for_declarative_test.go index de96f633c0..e1b6b779e9 100644 --- a/integrations/git_helper_for_declarative_test.go +++ b/integrations/git_helper_for_declarative_test.go @@ -14,7 +14,6 @@ import ( "path" "path/filepath" "strconv" - "strings" "testing" "time" @@ -60,21 +59,6 @@ func createSSHUrl(gitPath string, u *url.URL) *url.URL { return &u2 } -func allowLFSFilters() []string { - // Now here we should explicitly allow lfs filters to run - filteredLFSGlobalArgs := make([]string, len(git.GlobalCommandArgs)) - j := 0 - for _, arg := range git.GlobalCommandArgs { - if strings.Contains(arg, "lfs") { - j-- - } else { - filteredLFSGlobalArgs[j] = arg - j++ - } - } - return filteredLFSGlobalArgs[:j] -} - func onGiteaRunTB(t testing.TB, callback func(testing.TB, *url.URL), prepare ...bool) { if len(prepare) == 0 || prepare[0] { defer prepareTestEnv(t, 1)() @@ -115,7 +99,7 @@ func onGiteaRun(t *testing.T, callback func(*testing.T, *url.URL), prepare ...bo func doGitClone(dstLocalPath string, u *url.URL) func(*testing.T) { return func(t *testing.T) { - assert.NoError(t, git.CloneWithArgs(context.Background(), u.String(), dstLocalPath, allowLFSFilters(), git.CloneRepoOptions{})) + assert.NoError(t, git.CloneWithArgs(context.Background(), u.String(), dstLocalPath, git.AllowLFSFiltersArgs(), git.CloneRepoOptions{})) exist, err := util.IsExist(filepath.Join(dstLocalPath, "README.md")) assert.NoError(t, err) assert.True(t, exist) @@ -124,7 +108,7 @@ func doGitClone(dstLocalPath string, u *url.URL) func(*testing.T) { func doPartialGitClone(dstLocalPath string, u *url.URL) func(*testing.T) { return func(t *testing.T) { - assert.NoError(t, git.CloneWithArgs(context.Background(), u.String(), dstLocalPath, allowLFSFilters(), git.CloneRepoOptions{ + assert.NoError(t, git.CloneWithArgs(context.Background(), u.String(), dstLocalPath, git.AllowLFSFiltersArgs(), git.CloneRepoOptions{ Filter: "blob:none", })) exist, err := util.IsExist(filepath.Join(dstLocalPath, "README.md")) @@ -197,7 +181,7 @@ func doGitCreateBranch(dstPath, branch string) func(*testing.T) { func doGitCheckoutBranch(dstPath string, args ...string) func(*testing.T) { return func(t *testing.T) { - _, err := git.NewCommandNoGlobals(append(append(allowLFSFilters(), "checkout"), args...)...).RunInDir(dstPath) + _, err := git.NewCommandNoGlobals(append(append(git.AllowLFSFiltersArgs(), "checkout"), args...)...).RunInDir(dstPath) assert.NoError(t, err) } } @@ -211,7 +195,7 @@ func doGitMerge(dstPath string, args ...string) func(*testing.T) { func doGitPull(dstPath string, args ...string) func(*testing.T) { return func(t *testing.T) { - _, err := git.NewCommandNoGlobals(append(append(allowLFSFilters(), "pull"), args...)...).RunInDir(dstPath) + _, err := git.NewCommandNoGlobals(append(append(git.AllowLFSFiltersArgs(), "pull"), args...)...).RunInDir(dstPath) assert.NoError(t, err) } } |