mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-20 20:07:03 +01:00
#1900 last updatede time not update after push
This commit is contained in:
parent
05b419b219
commit
2bd64621fc
5 changed files with 21 additions and 23 deletions
|
@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
|
||||||
|
|
||||||
![](public/img/gogs-large-resize.png)
|
![](public/img/gogs-large-resize.png)
|
||||||
|
|
||||||
##### Current version: 0.6.26 Beta
|
##### Current version: 0.6.27 Beta
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
2
gogs.go
2
gogs.go
|
@ -17,7 +17,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.6.26.1104 Beta"
|
const APP_VER = "0.6.27.1105 Beta"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
|
@ -338,11 +338,9 @@ func CommitRepoAction(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change repository bare status and update last updated time.
|
// Change repository bare status and update last updated time.
|
||||||
if repo.IsBare {
|
repo.IsBare = false
|
||||||
repo.IsBare = false
|
if err = UpdateRepository(repo, false); err != nil {
|
||||||
if err = UpdateRepository(repo, false); err != nil {
|
return fmt.Errorf("UpdateRepository: %v", err)
|
||||||
return fmt.Errorf("UpdateRepository: %v", err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isNewBranch := false
|
isNewBranch := false
|
||||||
|
|
|
@ -47,10 +47,10 @@ func DeleteUpdateTaskByUUID(uuid string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName string, userId int64) error {
|
func Update(refName, oldCommitID, newCommitID, userName, repoUserName, repoName string, userID int64) error {
|
||||||
isNew := strings.HasPrefix(oldCommitId, "0000000")
|
isNew := strings.HasPrefix(oldCommitID, "0000000")
|
||||||
if isNew &&
|
if isNew &&
|
||||||
strings.HasPrefix(newCommitId, "0000000") {
|
strings.HasPrefix(newCommitID, "0000000") {
|
||||||
return fmt.Errorf("old rev and new rev both 000000")
|
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.Dir = f
|
||||||
gitUpdate.Run()
|
gitUpdate.Run()
|
||||||
|
|
||||||
isDel := strings.HasPrefix(newCommitId, "0000000")
|
isDel := strings.HasPrefix(newCommitID, "0000000")
|
||||||
if isDel {
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
repo, err := git.OpenRepository(f)
|
gitRepo, err := git.OpenRepository(f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("runUpdate.Open repoId: %v", err)
|
return fmt.Errorf("runUpdate.Open repoId: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ru, err := GetUserByName(repoUserName)
|
user, err := GetUserByName(repoUserName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("runUpdate.GetUserByName: %v", err)
|
return fmt.Errorf("runUpdate.GetUserByName: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
repos, err := GetRepositoryByName(ru.Id, repoName)
|
repo, err := GetRepositoryByName(user.Id, repoName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("runUpdate.GetRepositoryByName userId: %v", err)
|
return fmt.Errorf("runUpdate.GetRepositoryByName userId: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName
|
||||||
// Push tags.
|
// Push tags.
|
||||||
if strings.HasPrefix(refName, "refs/tags/") {
|
if strings.HasPrefix(refName, "refs/tags/") {
|
||||||
tagName := git.RefEndName(refName)
|
tagName := git.RefEndName(refName)
|
||||||
tag, err := repo.GetTag(tagName)
|
tag, err := gitRepo.GetTag(tagName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.GitLogger.Fatal(4, "runUpdate.GetTag: %v", err)
|
log.GitLogger.Fatal(4, "runUpdate.GetTag: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -102,14 +102,14 @@ func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName
|
||||||
|
|
||||||
commit := &base.PushCommits{}
|
commit := &base.PushCommits{}
|
||||||
|
|
||||||
if err = CommitRepoAction(userId, ru.Id, userName, actEmail,
|
if err = CommitRepoAction(userID, user.Id, userName, actEmail,
|
||||||
repos.ID, repoUserName, repoName, refName, commit, oldCommitId, newCommitId); err != nil {
|
repo.ID, repoUserName, repoName, refName, commit, oldCommitID, newCommitID); err != nil {
|
||||||
log.GitLogger.Fatal(4, "CommitRepoAction: %s/%s:%v", repoUserName, repoName, err)
|
log.GitLogger.Fatal(4, "CommitRepoAction: %s/%s:%v", repoUserName, repoName, err)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
newCommit, err := repo.GetCommit(newCommitId)
|
newCommit, err := gitRepo.GetCommit(newCommitID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("runUpdate GetCommit of newCommitId: %v", err)
|
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)
|
return fmt.Errorf("CommitsBefore: %v", err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
l, err = newCommit.CommitsBeforeUntil(oldCommitId)
|
l, err = newCommit.CommitsBeforeUntil(oldCommitID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("CommitsBeforeUntil: %v", err)
|
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,
|
if err = CommitRepoAction(userID, user.Id, userName, actEmail,
|
||||||
repos.ID, repoUserName, repoName, refName, &base.PushCommits{l.Len(), commits, ""}, oldCommitId, newCommitId); err != nil {
|
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 fmt.Errorf("runUpdate.models.CommitRepoAction: %s/%s:%v", repoUserName, repoName, err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.6.26.1104 Beta
|
0.6.27.1105 Beta
|
Loading…
Reference in a new issue