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)
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 {
})
return
}
- if err := repofiles.PushUpdate(repo, branch, models.PushUpdateOptions{
+ if err := repofiles.PushUpdate(repo, branch, repofiles.PushUpdateOptions{
RefFullName: refFullName,
OldCommitID: oldCommitID,
NewCommitID: newCommitID,
// 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(),
if err := repofiles.PushUpdate(
ctx.Repo.Repository,
branchName,
- models.PushUpdateOptions{
+ repofiles.PushUpdateOptions{
RefFullName: git.BranchPrefix + branchName,
OldCommitID: commit.ID.String(),
NewCommitID: git.EmptySHA,