diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2017-02-25 22:54:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-25 22:54:40 +0800 |
commit | cd1821a7e292b05e04fcc2a969b42d06ab512849 (patch) | |
tree | 084f97bfb24a37ec3028d15fdacb51e86cfcc368 /models/update.go | |
parent | e8e56da9ac321aacb3c06968997a45c2f133cd4e (diff) | |
download | gitea-cd1821a7e292b05e04fcc2a969b42d06ab512849.tar.gz gitea-cd1821a7e292b05e04fcc2a969b42d06ab512849.zip |
Move push update to post-receive and protected branch check to pre-receive (#1030)
* move all push update to git hook post-receive and protected branch check to git hook pre-receive
* add SSH_ORIGINAL_COMMAND check back
* remove all unused codes
* fix the import
Diffstat (limited to 'models/update.go')
-rw-r--r-- | models/update.go | 43 |
1 files changed, 9 insertions, 34 deletions
diff --git a/models/update.go b/models/update.go index 677a9bda31..3cb0608594 100644 --- a/models/update.go +++ b/models/update.go @@ -15,40 +15,15 @@ import ( "code.gitea.io/gitea/modules/log" ) -// UpdateTask defines an UpdateTask -type UpdateTask struct { - ID int64 `xorm:"pk autoincr"` - UUID string `xorm:"index"` - RefName string - OldCommitID string - NewCommitID string -} - -// AddUpdateTask adds an UpdateTask -func AddUpdateTask(task *UpdateTask) error { - _, err := x.Insert(task) - return err -} - -// GetUpdateTaskByUUID returns update task by given UUID. -func GetUpdateTaskByUUID(uuid string) (*UpdateTask, error) { - task := &UpdateTask{ - UUID: uuid, - } - has, err := x.Get(task) - if err != nil { - return nil, err - } else if !has { - return nil, ErrUpdateTaskNotExist{uuid} - } - return task, nil -} - -// DeleteUpdateTaskByUUID deletes an UpdateTask from the database -func DeleteUpdateTaskByUUID(uuid string) error { - _, err := x.Delete(&UpdateTask{UUID: uuid}) - return err -} +// env keys for git hooks need +const ( + EnvRepoName = "GITEA_REPO_NAME" + EnvRepoUsername = "GITEA_REPO_USER_NAME" + EnvRepoUserSalt = "GITEA_REPO_USER_SALT" + EnvRepoIsWiki = "GITEA_REPO_IS_WIKI" + EnvPusherName = "GITEA_PUSHER_NAME" + EnvPusherID = "GITEA_PUSHER_ID" +) // CommitToPushCommit transforms a git.Commit to PushCommit type. func CommitToPushCommit(commit *git.Commit) *PushCommit { |