Ver Fonte

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>
dependabot[bot] há 3 anos atrás
pai
commit
2601b40ffa
5 ficheiros alterados com 56 adições e 31 exclusões
  1. 5 0
      .golangci.yml
  2. 1 1
      go.mod
  3. 2 2
      go.sum
  4. 3 1
      internal/db/repo.go
  5. 45 27
      internal/db/repo_editor.go

+ 5 - 0
.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
 

+ 1 - 1
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

+ 2 - 2
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=

+ 3 - 1
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 {

+ 45 - 27
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)
 	}