summaryrefslogtreecommitdiffstats
path: root/models/update.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-11-05 19:18:59 -0500
committerUnknwon <u@gogs.io>2015-11-05 19:18:59 -0500
commit2bd64621fc7bff3fa5cf25b438b4e2895d58db54 (patch)
treee0a64432785e52eff9531ea18d85741db4d5fc66 /models/update.go
parent05b419b21984246f906aeb9a00e308184a785cf9 (diff)
downloadgitea-2bd64621fc7bff3fa5cf25b438b4e2895d58db54.tar.gz
gitea-2bd64621fc7bff3fa5cf25b438b4e2895d58db54.zip
#1900 last updatede time not update after push
Diffstat (limited to 'models/update.go')
-rw-r--r--models/update.go30
1 files changed, 15 insertions, 15 deletions
diff --git a/models/update.go b/models/update.go
index 0ca202213c..7992313a80 100644
--- a/models/update.go
+++ b/models/update.go
@@ -47,10 +47,10 @@ func DeleteUpdateTaskByUUID(uuid string) error {
return err
}
-func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName string, userId int64) error {
- isNew := strings.HasPrefix(oldCommitId, "0000000")
+func Update(refName, oldCommitID, newCommitID, userName, repoUserName, repoName string, userID int64) error {
+ isNew := strings.HasPrefix(oldCommitID, "0000000")
if isNew &&
- strings.HasPrefix(newCommitId, "0000000") {
+ strings.HasPrefix(newCommitID, "0000000") {
return fmt.Errorf("old rev and new rev both 000000")
}
@@ -60,23 +60,23 @@ func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName
gitUpdate.Dir = f
gitUpdate.Run()
- isDel := strings.HasPrefix(newCommitId, "0000000")
+ isDel := strings.HasPrefix(newCommitID, "0000000")
if isDel {
- log.GitLogger.Info("del rev", refName, "from", userName+"/"+repoName+".git", "by", userId)
+ log.GitLogger.Info("del rev", refName, "from", userName+"/"+repoName+".git", "by", userID)
return nil
}
- repo, err := git.OpenRepository(f)
+ gitRepo, err := git.OpenRepository(f)
if err != nil {
return fmt.Errorf("runUpdate.Open repoId: %v", err)
}
- ru, err := GetUserByName(repoUserName)
+ user, err := GetUserByName(repoUserName)
if err != nil {
return fmt.Errorf("runUpdate.GetUserByName: %v", err)
}
- repos, err := GetRepositoryByName(ru.Id, repoName)
+ repo, err := GetRepositoryByName(user.Id, repoName)
if err != nil {
return fmt.Errorf("runUpdate.GetRepositoryByName userId: %v", err)
}
@@ -84,7 +84,7 @@ func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName
// Push tags.
if strings.HasPrefix(refName, "refs/tags/") {
tagName := git.RefEndName(refName)
- tag, err := repo.GetTag(tagName)
+ tag, err := gitRepo.GetTag(tagName)
if err != nil {
log.GitLogger.Fatal(4, "runUpdate.GetTag: %v", err)
}
@@ -102,14 +102,14 @@ func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName
commit := &base.PushCommits{}
- if err = CommitRepoAction(userId, ru.Id, userName, actEmail,
- repos.ID, repoUserName, repoName, refName, commit, oldCommitId, newCommitId); err != nil {
+ if err = CommitRepoAction(userID, user.Id, userName, actEmail,
+ repo.ID, repoUserName, repoName, refName, commit, oldCommitID, newCommitID); err != nil {
log.GitLogger.Fatal(4, "CommitRepoAction: %s/%s:%v", repoUserName, repoName, err)
}
return err
}
- newCommit, err := repo.GetCommit(newCommitId)
+ newCommit, err := gitRepo.GetCommit(newCommitID)
if err != nil {
return fmt.Errorf("runUpdate GetCommit of newCommitId: %v", err)
}
@@ -122,7 +122,7 @@ func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName
return fmt.Errorf("CommitsBefore: %v", err)
}
} else {
- l, err = newCommit.CommitsBeforeUntil(oldCommitId)
+ l, err = newCommit.CommitsBeforeUntil(oldCommitID)
if err != nil {
return fmt.Errorf("CommitsBeforeUntil: %v", err)
}
@@ -148,8 +148,8 @@ func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName
})
}
- if err = CommitRepoAction(userId, ru.Id, userName, actEmail,
- repos.ID, repoUserName, repoName, refName, &base.PushCommits{l.Len(), commits, ""}, oldCommitId, newCommitId); err != nil {
+ if err = CommitRepoAction(userID, user.Id, userName, actEmail,
+ repo.ID, repoUserName, repoName, refName, &base.PushCommits{l.Len(), commits, ""}, oldCommitID, newCommitID); err != nil {
return fmt.Errorf("runUpdate.models.CommitRepoAction: %s/%s:%v", repoUserName, repoName, err)
}
return nil