mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-01 18:14:56 +02:00
lint related changes
This commit is contained in:
@@ -132,16 +132,16 @@ func HookPreReceive(ctx *gitea_context.PrivateContext) {
|
||||
newCommitID := opts.NewCommitIDs[i]
|
||||
refFullName := opts.RefFullNames[i]
|
||||
|
||||
//Check size
|
||||
if newCommitID != git.EmptySHA && repo.RepoSizeIsOversized(pushSize.Size) { //Check next size if we are not deleting a reference
|
||||
// Check size
|
||||
if newCommitID != git.EmptySHA && repo.RepoSizeIsOversized(pushSize.Size) { // Check next size if we are not deleting a reference
|
||||
log.Warn("Forbidden: new repo size is over limitation: %d", repo.SizeLimit)
|
||||
ctx.JSON(http.StatusForbidden, map[string]interface{}{
|
||||
"err": fmt.Sprintf("new repo size is over limitation: %d", repo.SizeLimit),
|
||||
})
|
||||
}
|
||||
//TODO investigate why on force push some git objects are not cleaned on server side.
|
||||
//TODO corner-case force push and branch creation -> git.EmptySHA == oldCommitID
|
||||
//TODO calculate pushed LFS objects size
|
||||
// TODO investigate why on force push some git objects are not cleaned on server side.
|
||||
// TODO corner-case force push and branch creation -> git.EmptySHA == oldCommitID
|
||||
// TODO calculate pushed LFS objects size
|
||||
|
||||
switch {
|
||||
case strings.HasPrefix(refFullName, git.BranchPrefix):
|
||||
|
||||
@@ -79,29 +79,29 @@ func testGit(t *testing.T, u *url.URL) {
|
||||
|
||||
t.Run("SizeLimit", func(t *testing.T) {
|
||||
t.Run("Under", func(t *testing.T) {
|
||||
PrintCurrentTest(t)
|
||||
tests.PrintCurrentTest(t)
|
||||
doCommitAndPush(t, littleSize, dstPath, "data-file-")
|
||||
})
|
||||
t.Run("Over", func(t *testing.T) {
|
||||
PrintCurrentTest(t)
|
||||
tests.PrintCurrentTest(t)
|
||||
doAPISetRepoSizeLimit(forkedUserCtx, forkedUserCtx.Username, forkedUserCtx.Reponame, littleSize)
|
||||
doCommitAndPushWithExpectedError(t, bigSize, dstPath, "data-file-")
|
||||
})
|
||||
t.Run("UnderAfterResize", func(t *testing.T) {
|
||||
PrintCurrentTest(t)
|
||||
tests.PrintCurrentTest(t)
|
||||
doAPISetRepoSizeLimit(forkedUserCtx, forkedUserCtx.Username, forkedUserCtx.Reponame, bigSize*10)
|
||||
doCommitAndPush(t, littleSize, dstPath, "data-file-")
|
||||
})
|
||||
t.Run("Deletion", func(t *testing.T) {
|
||||
PrintCurrentTest(t)
|
||||
//TODO doDeleteCommitAndPush(t, littleSize, dstPath, "data-file-")
|
||||
tests.PrintCurrentTest(t)
|
||||
// TODO doDeleteCommitAndPush(t, littleSize, dstPath, "data-file-")
|
||||
})
|
||||
//TODO delete branch
|
||||
//TODO delete tag
|
||||
//TODO add big commit that will be over with the push
|
||||
//TODO add lfs
|
||||
//TODO remove lfs
|
||||
//TODO add missing case
|
||||
// TODO delete branch
|
||||
// TODO delete tag
|
||||
// TODO add big commit that will be over with the push
|
||||
// TODO add lfs
|
||||
// TODO remove lfs
|
||||
// TODO add missing case
|
||||
})
|
||||
t.Run("CreateAgitFlowPull", doCreateAgitFlowPull(dstPath, &httpContext, "master", "test/head"))
|
||||
t.Run("BranchProtectMerge", doBranchProtectPRMerge(&httpContext, dstPath))
|
||||
@@ -324,7 +324,7 @@ func doCommitAndPush(t *testing.T, size int, repoPath, prefix string) string {
|
||||
func doCommitAndPushWithExpectedError(t *testing.T, size int, repoPath, prefix string) string {
|
||||
name, err := generateCommitWithNewData(size, repoPath, "user2@example.com", "User Two", prefix)
|
||||
assert.NoError(t, err)
|
||||
_, err = git.NewCommand("push", "origin", "master").RunInDir(repoPath) //Push
|
||||
_, _, err = git.NewCommand(git.DefaultContext, "push", "origin", "master").RunStdString(&git.RunOpts{Dir: repoPath}) // Push
|
||||
assert.Error(t, err)
|
||||
return name
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user