aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/update.go11
-rw-r--r--modules/repofiles/update.go13
-rw-r--r--routers/private/hook.go2
-rw-r--r--routers/private/push_update.go2
-rw-r--r--routers/repo/branch.go2
5 files changed, 15 insertions, 15 deletions
diff --git a/models/update.go b/models/update.go
index 5e941c22c4..deac91b6dc 100644
--- a/models/update.go
+++ b/models/update.go
@@ -53,17 +53,6 @@ func ListToPushCommits(l *list.List) *PushCommits {
return &PushCommits{l.Len(), commits, "", make(map[string]string), make(map[string]*User)}
}
-// PushUpdateOptions defines the push update options
-type PushUpdateOptions struct {
- PusherID int64
- PusherName string
- RepoUserName string
- RepoName string
- RefFullName string
- OldCommitID string
- NewCommitID string
-}
-
// PushUpdateDeleteTag must be called for any push actions to delete tag
func PushUpdateDeleteTag(repo *Repository, tagName string) error {
rel, err := GetRelease(repo.ID, tagName)
diff --git a/modules/repofiles/update.go b/modules/repofiles/update.go
index ef56609f4d..c1eae53099 100644
--- a/modules/repofiles/update.go
+++ b/modules/repofiles/update.go
@@ -410,9 +410,20 @@ func CreateOrUpdateRepoFile(repo *models.Repository, doer *models.User, opts *Up
return file, nil
}
+// PushUpdateOptions defines the push update options
+type PushUpdateOptions struct {
+ PusherID int64
+ PusherName string
+ RepoUserName string
+ RepoName string
+ RefFullName string
+ OldCommitID string
+ NewCommitID string
+}
+
// PushUpdate must be called for any push actions in order to
// generates necessary push action history feeds and other operations
-func PushUpdate(repo *models.Repository, branch string, opts models.PushUpdateOptions) error {
+func PushUpdate(repo *models.Repository, branch string, opts PushUpdateOptions) error {
isNewRef := opts.OldCommitID == git.EmptySHA
isDelRef := opts.NewCommitID == git.EmptySHA
if isNewRef && isDelRef {
diff --git a/routers/private/hook.go b/routers/private/hook.go
index 074e3aef19..c9065bceb3 100644
--- a/routers/private/hook.go
+++ b/routers/private/hook.go
@@ -159,7 +159,7 @@ func HookPostReceive(ctx *macaron.Context) {
})
return
}
- if err := repofiles.PushUpdate(repo, branch, models.PushUpdateOptions{
+ if err := repofiles.PushUpdate(repo, branch, repofiles.PushUpdateOptions{
RefFullName: refFullName,
OldCommitID: oldCommitID,
NewCommitID: newCommitID,
diff --git a/routers/private/push_update.go b/routers/private/push_update.go
index 42eda3178b..d8102cbfbe 100644
--- a/routers/private/push_update.go
+++ b/routers/private/push_update.go
@@ -18,7 +18,7 @@ import (
// PushUpdate update public key updates
func PushUpdate(ctx *macaron.Context) {
- var opt models.PushUpdateOptions
+ var opt repofiles.PushUpdateOptions
if err := json.NewDecoder(ctx.Req.Request.Body).Decode(&opt); err != nil {
ctx.JSON(500, map[string]interface{}{
"err": err.Error(),
diff --git a/routers/repo/branch.go b/routers/repo/branch.go
index 0c06de3ea6..306deca36e 100644
--- a/routers/repo/branch.go
+++ b/routers/repo/branch.go
@@ -137,7 +137,7 @@ func deleteBranch(ctx *context.Context, branchName string) error {
if err := repofiles.PushUpdate(
ctx.Repo.Repository,
branchName,
- models.PushUpdateOptions{
+ repofiles.PushUpdateOptions{
RefFullName: git.BranchPrefix + branchName,
OldCommitID: commit.ID.String(),
NewCommitID: git.EmptySHA,