summaryrefslogtreecommitdiffstats
path: root/routers/private/hook.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-07-29 18:53:04 +0100
committerGitHub <noreply@github.com>2020-07-29 13:53:04 -0400
commit2f6aadffa8243736825564cd1ce32d0d5a1eb391 (patch)
treeffd0d52a2303e04bee16bf019d5670b5c54d9256 /routers/private/hook.go
parentf2a6cd6401d3d04c7b6c769d39d68262abbdaae1 (diff)
downloadgitea-2f6aadffa8243736825564cd1ce32d0d5a1eb391.tar.gz
gitea-2f6aadffa8243736825564cd1ce32d0d5a1eb391.zip
Git 2.28 no longer permits diff with ... on unrelated branches (#12364)
* Git 2.28 no longer permits diff with ... on unrelated branches Signed-off-by: Andrew Thornton <art27@cantab.net> * need to check stderr
Diffstat (limited to 'routers/private/hook.go')
-rw-r--r--routers/private/hook.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/routers/private/hook.go b/routers/private/hook.go
index 4b57aff588..215793c970 100644
--- a/routers/private/hook.go
+++ b/routers/private/hook.go
@@ -39,6 +39,7 @@ func verifyCommits(oldCommitID, newCommitID string, repo *git.Repository, env []
_ = stdoutWriter.Close()
}()
+ // This is safe as force pushes are already forbidden
err = git.NewCommand("rev-list", oldCommitID+"..."+newCommitID).
RunInDirTimeoutEnvFullPipelineFunc(env, -1, repo.Path,
stdoutWriter, nil, nil,
@@ -70,6 +71,7 @@ func checkFileProtection(oldCommitID, newCommitID string, patterns []glob.Glob,
_ = stdoutWriter.Close()
}()
+ // This use of ... is safe as force-pushes have already been ruled out.
err = git.NewCommand("diff", "--name-only", oldCommitID+"..."+newCommitID).
RunInDirTimeoutEnvFullPipelineFunc(env, -1, repo.Path,
stdoutWriter, nil, nil,