From 2601b40ffaff032a95bbe777b6a80845e6041998 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 5 Apr 2022 16:45:01 +0800
Subject: [PATCH] mod: bump github.com/gogs/git-module from 1.5.0 to 1.6.0
 (#6894)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Joe Chen <jc@unknwon.io>
---
 .golangci.yml              |  5 +++
 go.mod                     |  2 +-
 go.sum                     |  4 +--
 internal/db/repo.go        |  4 ++-
 internal/db/repo_editor.go | 72 ++++++++++++++++++++++++--------------
 5 files changed, 56 insertions(+), 31 deletions(-)

diff --git a/.golangci.yml b/.golangci.yml
index 5748c6452..631e36925 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -1,4 +1,9 @@
 linters-settings:
+  staticcheck:
+    checks: [
+      "all",
+      "-SA1019" # There are valid use cases of strings.Title
+    ]
   nakedret:
     max-func-lines: 0 # Disallow any unnamed return statement
 
diff --git a/go.mod b/go.mod
index 61ef1ddaa..047486256 100644
--- a/go.mod
+++ b/go.mod
@@ -18,7 +18,7 @@ require (
 	github.com/go-macaron/toolbox v0.0.0-20190813233741-94defb8383c6
 	github.com/gogs/chardet v0.0.0-20150115103509-2404f7772561
 	github.com/gogs/cron v0.0.0-20171120032916-9f6c956d3e14
-	github.com/gogs/git-module v1.5.0
+	github.com/gogs/git-module v1.6.0
 	github.com/gogs/go-gogs-client v0.0.0-20200128182646-c69cb7680fd4
 	github.com/gogs/go-libravatar v0.0.0-20191106065024-33a75213d0a0
 	github.com/gogs/minwinsvc v0.0.0-20170301035411-95be6356811a
diff --git a/go.sum b/go.sum
index 0412cc69c..e0f302925 100644
--- a/go.sum
+++ b/go.sum
@@ -149,8 +149,8 @@ github.com/gogs/chardet v0.0.0-20150115103509-2404f7772561 h1:aBzukfDxQlCTVS0NBU
 github.com/gogs/chardet v0.0.0-20150115103509-2404f7772561/go.mod h1:Pcatq5tYkCW2Q6yrR2VRHlbHpZ/R4/7qyL1TCF7vl14=
 github.com/gogs/cron v0.0.0-20171120032916-9f6c956d3e14 h1:yXtpJr/LV6PFu4nTLgfjQdcMdzjbqqXMEnHfq0Or6p8=
 github.com/gogs/cron v0.0.0-20171120032916-9f6c956d3e14/go.mod h1:jPoNZLWDAqA5N3G5amEoiNbhVrmM+ZQEcnQvNQ2KaZk=
-github.com/gogs/git-module v1.5.0 h1:2aAO79c36R3L6TdKutbVJwr0YwSWfRbPNP456yxDXtk=
-github.com/gogs/git-module v1.5.0/go.mod h1:oN37FFStFjdnTJXsSbhIHKJXh2YeDsEcXPATVz/oeuQ=
+github.com/gogs/git-module v1.6.0 h1:71GdRM9/pFxGgSUz8t2DKmm3RYuHUnTjsOuFInJXnkM=
+github.com/gogs/git-module v1.6.0/go.mod h1:8jFYhDxLUwEOhM2709l2CJXmoIIslobU1xszpT0NcAI=
 github.com/gogs/go-gogs-client v0.0.0-20200128182646-c69cb7680fd4 h1:C7NryI/RQhsIWwC2bHN601P1wJKeuQ6U/UCOYTn3Cic=
 github.com/gogs/go-gogs-client v0.0.0-20200128182646-c69cb7680fd4/go.mod h1:fR6z1Ie6rtF7kl/vBYMfgD5/G5B1blui7z426/sj2DU=
 github.com/gogs/go-libravatar v0.0.0-20191106065024-33a75213d0a0 h1:K02vod+sn3M1OOkdqi2tPxN2+xESK4qyITVQ3JkGEv4=
diff --git a/internal/db/repo.go b/internal/db/repo.go
index 1c85583a8..9f17b9a5c 100644
--- a/internal/db/repo.go
+++ b/internal/db/repo.go
@@ -1980,7 +1980,9 @@ func GitFsck() {
 			repo := bean.(*Repository)
 			repoPath := repo.RepoPath()
 			err := git.Fsck(repoPath, git.FsckOptions{
-				Args:    conf.Cron.RepoHealthCheck.Args,
+				CommandOptions: git.CommandOptions{
+					Args: conf.Cron.RepoHealthCheck.Args,
+				},
 				Timeout: conf.Cron.RepoHealthCheck.Timeout,
 			})
 			if err != nil {
diff --git a/internal/db/repo_editor.go b/internal/db/repo_editor.go
index cf2426f6c..71a8cfeae 100644
--- a/internal/db/repo_editor.go
+++ b/internal/db/repo_editor.go
@@ -184,15 +184,21 @@ func (repo *Repository) UpdateRepoFile(doer *User, opts UpdateRepoFileOptions) (
 		return fmt.Errorf("commit changes on %q: %v", localPath, err)
 	}
 
-	envs := ComposeHookEnvs(ComposeHookEnvsOptions{
-		AuthUser:  doer,
-		OwnerName: repo.MustOwner().Name,
-		OwnerSalt: repo.MustOwner().Salt,
-		RepoID:    repo.ID,
-		RepoName:  repo.Name,
-		RepoPath:  repo.RepoPath(),
-	})
-	if err = git.Push(localPath, "origin", opts.NewBranch, git.PushOptions{Envs: envs}); err != nil {
+	err = git.Push(localPath, "origin", opts.NewBranch,
+		git.PushOptions{
+			CommandOptions: git.CommandOptions{
+				Envs: ComposeHookEnvs(ComposeHookEnvsOptions{
+					AuthUser:  doer,
+					OwnerName: repo.MustOwner().Name,
+					OwnerSalt: repo.MustOwner().Salt,
+					RepoID:    repo.ID,
+					RepoName:  repo.Name,
+					RepoPath:  repo.RepoPath(),
+				}),
+			},
+		},
+	)
+	if err != nil {
 		return fmt.Errorf("git push origin %s: %v", opts.NewBranch, err)
 	}
 	return nil
@@ -289,15 +295,21 @@ func (repo *Repository) DeleteRepoFile(doer *User, opts DeleteRepoFileOptions) (
 		return fmt.Errorf("commit changes to %q: %v", localPath, err)
 	}
 
-	envs := ComposeHookEnvs(ComposeHookEnvsOptions{
-		AuthUser:  doer,
-		OwnerName: repo.MustOwner().Name,
-		OwnerSalt: repo.MustOwner().Salt,
-		RepoID:    repo.ID,
-		RepoName:  repo.Name,
-		RepoPath:  repo.RepoPath(),
-	})
-	if err = git.Push(localPath, "origin", opts.NewBranch, git.PushOptions{Envs: envs}); err != nil {
+	err = git.Push(localPath, "origin", opts.NewBranch,
+		git.PushOptions{
+			CommandOptions: git.CommandOptions{
+				Envs: ComposeHookEnvs(ComposeHookEnvsOptions{
+					AuthUser:  doer,
+					OwnerName: repo.MustOwner().Name,
+					OwnerSalt: repo.MustOwner().Salt,
+					RepoID:    repo.ID,
+					RepoName:  repo.Name,
+					RepoPath:  repo.RepoPath(),
+				}),
+			},
+		},
+	)
+	if err != nil {
 		return fmt.Errorf("git push origin %s: %v", opts.NewBranch, err)
 	}
 	return nil
@@ -513,15 +525,21 @@ func (repo *Repository) UploadRepoFiles(doer *User, opts UploadRepoFileOptions)
 		return fmt.Errorf("commit changes on %q: %v", localPath, err)
 	}
 
-	envs := ComposeHookEnvs(ComposeHookEnvsOptions{
-		AuthUser:  doer,
-		OwnerName: repo.MustOwner().Name,
-		OwnerSalt: repo.MustOwner().Salt,
-		RepoID:    repo.ID,
-		RepoName:  repo.Name,
-		RepoPath:  repo.RepoPath(),
-	})
-	if err = git.Push(localPath, "origin", opts.NewBranch, git.PushOptions{Envs: envs}); err != nil {
+	err = git.Push(localPath, "origin", opts.NewBranch,
+		git.PushOptions{
+			CommandOptions: git.CommandOptions{
+				Envs: ComposeHookEnvs(ComposeHookEnvsOptions{
+					AuthUser:  doer,
+					OwnerName: repo.MustOwner().Name,
+					OwnerSalt: repo.MustOwner().Salt,
+					RepoID:    repo.ID,
+					RepoName:  repo.Name,
+					RepoPath:  repo.RepoPath(),
+				}),
+			},
+		},
+	)
+	if err != nil {
 		return fmt.Errorf("git push origin %s: %v", opts.NewBranch, err)
 	}