diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2017-10-29 03:36:20 +0800 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2017-10-28 22:36:20 +0300 |
commit | 9ddbbd9d5a67e430ccf942d28088c9b4c2bb991f (patch) | |
tree | 1033f00526c25c415c3486a939b19a47870ce077 /cmd/hook.go | |
parent | 1da17db7172a87532e394b767cb44a7b5660181e (diff) | |
download | gitea-9ddbbd9d5a67e430ccf942d28088c9b4c2bb991f.tar.gz gitea-9ddbbd9d5a67e430ccf942d28088c9b4c2bb991f.zip |
improve force push detect when push (#2798)
Diffstat (limited to 'cmd/hook.go')
-rw-r--r-- | cmd/hook.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd/hook.go b/cmd/hook.go index 0ddbb36f90..9d805e4ef5 100644 --- a/cmd/hook.go +++ b/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 { |