mirror of
https://github.com/go-gitea/gitea
synced 2024-12-23 09:04:26 +00:00
Fix wrong serve command log location and commit repo action
This commit is contained in:
parent
09e7e76204
commit
197c4d4a5b
@ -59,7 +59,7 @@ func (a Action) GetContent() string {
|
|||||||
// CommitRepoAction records action for commit repository.
|
// CommitRepoAction records action for commit repository.
|
||||||
func CommitRepoAction(userId int64, userName string,
|
func CommitRepoAction(userId int64, userName string,
|
||||||
repoId int64, repoName string, refName string, commits *base.PushCommits) error {
|
repoId int64, repoName string, refName string, commits *base.PushCommits) error {
|
||||||
log.Trace("action.CommitRepoAction: %d/%s", userId, repoName)
|
log.Trace("action.CommitRepoAction(start): %d/%s", userId, repoName)
|
||||||
|
|
||||||
bs, err := json.Marshal(commits)
|
bs, err := json.Marshal(commits)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -92,9 +92,9 @@ func CommitRepoAction(userId int64, userName string,
|
|||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("action.CommitRepoAction(notify watches): %d/%s", userId, repoName)
|
log.Error("action.CommitRepoAction(notify watches): %d/%s", userId, repoName)
|
||||||
}
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update repository last update time.
|
// Update repository last update time.
|
||||||
repo, err := GetRepositoryByName(userId, repoName)
|
repo, err := GetRepositoryByName(userId, repoName)
|
||||||
@ -107,6 +107,8 @@ func CommitRepoAction(userId int64, userName string,
|
|||||||
log.Error("action.CommitRepoAction(UpdateRepository): %d/%s", userId, repoName)
|
log.Error("action.CommitRepoAction(UpdateRepository): %d/%s", userId, repoName)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Trace("action.CommitRepoAction(end): %d/%s", userId, repoName)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ var Service struct {
|
|||||||
ResetPwdCodeLives int
|
ResetPwdCodeLives int
|
||||||
}
|
}
|
||||||
|
|
||||||
func exeDir() (string, error) {
|
func ExecDir() (string, error) {
|
||||||
file, err := exec.LookPath(os.Args[0])
|
file, err := exec.LookPath(os.Args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
@ -244,7 +244,7 @@ func newNotifyMailService() {
|
|||||||
|
|
||||||
func NewConfigContext() {
|
func NewConfigContext() {
|
||||||
//var err error
|
//var err error
|
||||||
workDir, err := exeDir()
|
workDir, err := ExecDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Fail to get work directory: %s\n", err)
|
fmt.Printf("Fail to get work directory: %s\n", err)
|
||||||
os.Exit(2)
|
os.Exit(2)
|
||||||
|
@ -73,7 +73,7 @@ func RepoAssignment(redirect bool) martini.Handler {
|
|||||||
if base.EnableHttpsClone {
|
if base.EnableHttpsClone {
|
||||||
scheme = "https"
|
scheme = "https"
|
||||||
}
|
}
|
||||||
ctx.Repo.CloneLink.SSH = fmt.Sprintf("git@%s:%s/%s.git", base.Domain, user.LowerName, repo.LowerName)
|
ctx.Repo.CloneLink.SSH = fmt.Sprintf("%s@%s:%s/%s.git", base.RunUser, base.Domain, user.LowerName, repo.LowerName)
|
||||||
ctx.Repo.CloneLink.HTTPS = fmt.Sprintf("%s://%s/%s/%s.git", scheme, base.Domain, user.LowerName, repo.LowerName)
|
ctx.Repo.CloneLink.HTTPS = fmt.Sprintf("%s://%s/%s/%s.git", scheme, base.Domain, user.LowerName, repo.LowerName)
|
||||||
|
|
||||||
ctx.Data["IsRepositoryValid"] = true
|
ctx.Data["IsRepositoryValid"] = true
|
||||||
|
6
serve.go
6
serve.go
@ -45,10 +45,10 @@ gogs serv provide access auth for repositories`,
|
|||||||
Flags: []cli.Flag{},
|
Flags: []cli.Flag{},
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func newLogger(execDir string) {
|
||||||
level := "0"
|
level := "0"
|
||||||
os.MkdirAll("log", os.ModePerm)
|
os.MkdirAll("log", os.ModePerm)
|
||||||
log.NewLogger(10000, "file", fmt.Sprintf(`{"level":%s,"filename":"%s"}`, level, "log/serv.log"))
|
log.NewLogger(10000, "file", fmt.Sprintf(`{"level":%s,"filename":"%s"}`, level, execDir+"/log/serv.log"))
|
||||||
log.Trace("start logging...")
|
log.Trace("start logging...")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,6 +73,8 @@ func In(b string, sl map[string]int) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runServ(k *cli.Context) {
|
func runServ(k *cli.Context) {
|
||||||
|
execDir, _ := base.ExecDir()
|
||||||
|
newLogger(execDir)
|
||||||
log.Trace("new serv request " + log.Mode + ":" + log.Config)
|
log.Trace("new serv request " + log.Mode + ":" + log.Config)
|
||||||
|
|
||||||
base.NewConfigContext()
|
base.NewConfigContext()
|
||||||
|
Loading…
Reference in New Issue
Block a user