|
|
@@ -199,10 +199,6 @@ func HookPreReceive(ctx *macaron.Context, opts private.HookOptions) { |
|
|
|
env = append(env, |
|
|
|
private.GitQuarantinePath+"="+opts.GitQuarantinePath) |
|
|
|
} |
|
|
|
os.Setenv(models.EnvRepoMaxFileSize, fmt.Sprint(setting.Repository.Upload.FileMaxSize)) |
|
|
|
os.Setenv(models.EnvRepoMaxSize, fmt.Sprint(setting.Repository.RepoMaxSize)) |
|
|
|
os.Setenv(models.EnvPushSizeCheckFlag, fmt.Sprint(setting.Repository.Upload.ShellFlag)) |
|
|
|
os.Setenv(models.EnvRepoSize, fmt.Sprint(repo.Size)) |
|
|
|
for i := range opts.OldCommitIDs { |
|
|
|
oldCommitID := opts.OldCommitIDs[i] |
|
|
|
newCommitID := opts.NewCommitIDs[i] |
|
|
@@ -371,6 +367,23 @@ func HookPreReceive(ctx *macaron.Context, opts private.HookOptions) { |
|
|
|
ctx.PlainText(http.StatusOK, []byte("ok")) |
|
|
|
} |
|
|
|
|
|
|
|
// HookEnv |
|
|
|
func HookEnv(ctx *macaron.Context) { |
|
|
|
ownerName := ctx.Params(":owner") |
|
|
|
repoName := ctx.Params(":repo") |
|
|
|
repo, err := models.GetRepositoryByOwnerAndName(ownerName, repoName) |
|
|
|
if err != nil { |
|
|
|
log.Error("Unable to get repository: %s/%s Error: %v", ownerName, repoName, err) |
|
|
|
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{ |
|
|
|
"err": err.Error(), |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|
result := make(map[string]string, 1) |
|
|
|
result[models.EnvRepoSize] = fmt.Sprint(repo.Size) |
|
|
|
ctx.JSON(http.StatusOK, &private.HookEnvResult{Config: result}) |
|
|
|
} |
|
|
|
|
|
|
|
// HookPostReceive updates services and users |
|
|
|
func HookPostReceive(ctx *macaron.Context, opts private.HookOptions) { |
|
|
|
ownerName := ctx.Params(":owner") |
|
|
|