Skip to content

Commit 75585de

Browse files
lint related changes
1 parent 20bfff3 commit 75585de

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

routers/private/hook_pre_receive.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,16 @@ func HookPreReceive(ctx *gitea_context.PrivateContext) {
132132
newCommitID := opts.NewCommitIDs[i]
133133
refFullName := opts.RefFullNames[i]
134134

135-
//Check size
136-
if newCommitID != git.EmptySHA && repo.RepoSizeIsOversized(pushSize.Size) { //Check next size if we are not deleting a reference
135+
// Check size
136+
if newCommitID != git.EmptySHA && repo.RepoSizeIsOversized(pushSize.Size) { // Check next size if we are not deleting a reference
137137
log.Warn("Forbidden: new repo size is over limitation: %d", repo.SizeLimit)
138138
ctx.JSON(http.StatusForbidden, map[string]interface{}{
139139
"err": fmt.Sprintf("new repo size is over limitation: %d", repo.SizeLimit),
140140
})
141141
}
142-
//TODO investigate why on force push some git objects are not cleaned on server side.
143-
//TODO corner-case force push and branch creation -> git.EmptySHA == oldCommitID
144-
//TODO calculate pushed LFS objects size
142+
// TODO investigate why on force push some git objects are not cleaned on server side.
143+
// TODO corner-case force push and branch creation -> git.EmptySHA == oldCommitID
144+
// TODO calculate pushed LFS objects size
145145

146146
switch {
147147
case strings.HasPrefix(refFullName, git.BranchPrefix):

tests/integration/git_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,29 +79,29 @@ func testGit(t *testing.T, u *url.URL) {
7979

8080
t.Run("SizeLimit", func(t *testing.T) {
8181
t.Run("Under", func(t *testing.T) {
82-
PrintCurrentTest(t)
82+
tests.PrintCurrentTest(t)
8383
doCommitAndPush(t, littleSize, dstPath, "data-file-")
8484
})
8585
t.Run("Over", func(t *testing.T) {
86-
PrintCurrentTest(t)
86+
tests.PrintCurrentTest(t)
8787
doAPISetRepoSizeLimit(forkedUserCtx, forkedUserCtx.Username, forkedUserCtx.Reponame, littleSize)
8888
doCommitAndPushWithExpectedError(t, bigSize, dstPath, "data-file-")
8989
})
9090
t.Run("UnderAfterResize", func(t *testing.T) {
91-
PrintCurrentTest(t)
91+
tests.PrintCurrentTest(t)
9292
doAPISetRepoSizeLimit(forkedUserCtx, forkedUserCtx.Username, forkedUserCtx.Reponame, bigSize*10)
9393
doCommitAndPush(t, littleSize, dstPath, "data-file-")
9494
})
9595
t.Run("Deletion", func(t *testing.T) {
96-
PrintCurrentTest(t)
97-
//TODO doDeleteCommitAndPush(t, littleSize, dstPath, "data-file-")
96+
tests.PrintCurrentTest(t)
97+
// TODO doDeleteCommitAndPush(t, littleSize, dstPath, "data-file-")
9898
})
99-
//TODO delete branch
100-
//TODO delete tag
101-
//TODO add big commit that will be over with the push
102-
//TODO add lfs
103-
//TODO remove lfs
104-
//TODO add missing case
99+
// TODO delete branch
100+
// TODO delete tag
101+
// TODO add big commit that will be over with the push
102+
// TODO add lfs
103+
// TODO remove lfs
104+
// TODO add missing case
105105
})
106106
t.Run("CreateAgitFlowPull", doCreateAgitFlowPull(dstPath, &httpContext, "master", "test/head"))
107107
t.Run("BranchProtectMerge", doBranchProtectPRMerge(&httpContext, dstPath))
@@ -324,7 +324,7 @@ func doCommitAndPush(t *testing.T, size int, repoPath, prefix string) string {
324324
func doCommitAndPushWithExpectedError(t *testing.T, size int, repoPath, prefix string) string {
325325
name, err := generateCommitWithNewData(size, repoPath, "[email protected]", "User Two", prefix)
326326
assert.NoError(t, err)
327-
_, err = git.NewCommand("push", "origin", "master").RunInDir(repoPath) //Push
327+
_, _, err = git.NewCommand(git.DefaultContext, "push", "origin", "master").RunStdString(&git.RunOpts{Dir: repoPath}) // Push
328328
assert.Error(t, err)
329329
return name
330330
}

0 commit comments

Comments
 (0)