Browse Source

improve force push detect when push (#2798)

tags/v1.3.0-rc1
Lunny Xiao 8 years ago committed by Lauris BH
parent
commit
9ddbbd9d5a
  1. 2
      cmd/hook.go

2
cmd/hook.go

@ -118,7 +118,7 @@ func runHookPreReceive(c *cli.Context) error {
if protectBranch != nil && protectBranch.IsProtected() {
// detect force push
if git.EmptySHA != oldCommitID {
output, err := git.NewCommand("rev-list", oldCommitID, "^"+newCommitID).RunInDir(repoPath)
output, err := git.NewCommand("rev-list", "--max-count=1", oldCommitID, "^"+newCommitID).RunInDir(repoPath)
if err != nil {
fail("Internal error", "Fail to detect force push: %v", err)
} else if len(output) > 0 {

Loading…
Cancel
Save