mirror of
https://github.com/go-gitea/gitea.git
synced 2024-08-25 21:44:20 -04:00
bug fixed
This commit is contained in:
parent
20ec459b93
commit
9b509054cf
@ -261,7 +261,6 @@ func initRepository(f string, user *User, repo *Repository, initReadme bool, rep
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// hook/post-update
|
// hook/post-update
|
||||||
pu, err := os.OpenFile(filepath.Join(repoPath, "hooks", "post-update"), os.O_CREATE|os.O_WRONLY, 0777)
|
pu, err := os.OpenFile(filepath.Join(repoPath, "hooks", "post-update"), os.O_CREATE|os.O_WRONLY, 0777)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -269,11 +268,11 @@ func initRepository(f string, user *User, repo *Repository, initReadme bool, rep
|
|||||||
}
|
}
|
||||||
defer pu.Close()
|
defer pu.Close()
|
||||||
// TODO: Windows .bat
|
// TODO: Windows .bat
|
||||||
if _, err = pu.WriteString(fmt.Sprintf("#!/usr/bin/env bash\n%s update\n", appPath)); err != nil {
|
if _, err = pu.WriteString(fmt.Sprintf("#!/usr/bin/env bash\n%s update ARGV[0] ARGV[1] ARGV[2]\n", appPath)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// hook/post-update
|
/*// hook/post-update
|
||||||
pu2, err := os.OpenFile(filepath.Join(repoPath, "hooks", "post-receive"), os.O_CREATE|os.O_WRONLY, 0777)
|
pu2, err := os.OpenFile(filepath.Join(repoPath, "hooks", "post-receive"), os.O_CREATE|os.O_WRONLY, 0777)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
22
serve.go
22
serve.go
@ -212,18 +212,18 @@ func runServ(k *cli.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if isRead {
|
//if isRead {
|
||||||
return
|
return
|
||||||
}
|
//}
|
||||||
|
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
log.Info(s)
|
log.Info(s)
|
||||||
|
|
||||||
// find push reference name
|
// find push reference name
|
||||||
var t = "ok refs/heads/"
|
//var t = "ok refs/heads/"
|
||||||
var i int
|
//var i int
|
||||||
var refname string
|
var refname string
|
||||||
for {
|
/*for {
|
||||||
l, err := b.ReadString('\n')
|
l, err := b.ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
break
|
||||||
@ -235,6 +235,18 @@ func runServ(k *cli.Context) {
|
|||||||
refname = l[idx+len(t):]
|
refname = l[idx+len(t):]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
refs2, err := rep.AllReferencesMap()
|
||||||
|
for name, ref := range refs2 {
|
||||||
|
if ref2, ok := refs[name]; ok {
|
||||||
|
if ref.Oid.Equal(ref2.Oid) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
refname = name
|
||||||
|
break
|
||||||
|
}
|
||||||
if refname == "" {
|
if refname == "" {
|
||||||
println("No find any reference name:", s)
|
println("No find any reference name:", s)
|
||||||
return
|
return
|
||||||
|
24
update.go
24
update.go
@ -4,9 +4,12 @@
|
|||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "github.com/codegangsta/cli"
|
import (
|
||||||
|
"fmt"
|
||||||
//"github.com/gogits/gogs/modules/log"
|
"os"
|
||||||
|
"github.com/codegangsta/cli"
|
||||||
|
"github.com/gogits/gogs/modules/log"
|
||||||
|
)
|
||||||
|
|
||||||
var CmdUpdate = cli.Command{
|
var CmdUpdate = cli.Command{
|
||||||
Name: "update",
|
Name: "update",
|
||||||
@ -18,11 +21,18 @@ gogs serv provide access auth for repositories`,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// for command: ./gogs update
|
// for command: ./gogs update
|
||||||
func runUpdate(*cli.Context) {
|
func runUpdate(c *cli.Context) {
|
||||||
/*w, _ := os.Create("update.log")
|
level := "0"
|
||||||
log.SetOutput(w)
|
os.MkdirAll("log", os.ModePerm)
|
||||||
|
log.NewLogger(10000, "file", fmt.Sprintf(`{"level":%s,"filename":"%s"}`, level, "log/serv.log"))
|
||||||
|
log.Info("start update logging...")
|
||||||
|
|
||||||
userName := os.Getenv("userName")
|
//w, _ := os.Create("update.log")
|
||||||
|
//log.SetOutput(w)
|
||||||
|
for i, arg := range c.Args() {
|
||||||
|
log.Info("%d : %s", i, arg)
|
||||||
|
}
|
||||||
|
/*userName := os.Getenv("userName")
|
||||||
userId := os.Getenv("userId")
|
userId := os.Getenv("userId")
|
||||||
repoId := os.Getenv("repoId")
|
repoId := os.Getenv("repoId")
|
||||||
repoName := os.Getenv("repoName")
|
repoName := os.Getenv("repoName")
|
||||||
|
Loading…
Reference in New Issue
Block a user