mirror of
https://github.com/gogs/gogs.git
synced 2026-03-01 01:30:57 +01:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
afc6cbc479 | ||
|
|
1f059502dc | ||
|
|
01a516b584 | ||
|
|
48c98c92c8 | ||
|
|
6fe43eb8d4 |
2
gogs.go
2
gogs.go
@@ -17,7 +17,7 @@ import (
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
const APP_VER = "0.4.0.0531 Alpha"
|
||||
const APP_VER = "0.4.1.0601 Alpha"
|
||||
|
||||
func init() {
|
||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||
|
||||
@@ -18,7 +18,6 @@ import (
|
||||
|
||||
"github.com/Unknwon/cae/zip"
|
||||
"github.com/Unknwon/com"
|
||||
qlog "github.com/qiniu/log"
|
||||
|
||||
"github.com/gogits/git"
|
||||
|
||||
@@ -84,12 +83,22 @@ func NewRepoContext() {
|
||||
// Check if server has basic git setting.
|
||||
stdout, stderr, err := com.ExecCmd("git", "config", "--get", "user.name")
|
||||
if strings.Contains(stderr, "fatal:") {
|
||||
qlog.Fatalf("repo.NewRepoContext(fail to get git user.name): %s", stderr)
|
||||
log.Fatal("repo.NewRepoContext(fail to get git user.name): %s", stderr)
|
||||
} else if err != nil || len(strings.TrimSpace(stdout)) == 0 {
|
||||
if _, stderr, err = com.ExecCmd("git", "config", "--global", "user.email", "gogitservice@gmail.com"); err != nil {
|
||||
qlog.Fatalf("repo.NewRepoContext(fail to set git user.email): %s", stderr)
|
||||
log.Fatal("repo.NewRepoContext(fail to set git user.email): %s", stderr)
|
||||
} else if _, stderr, err = com.ExecCmd("git", "config", "--global", "user.name", "Gogs"); err != nil {
|
||||
qlog.Fatalf("repo.NewRepoContext(fail to set git user.name): %s", stderr)
|
||||
log.Fatal("repo.NewRepoContext(fail to set git user.name): %s", stderr)
|
||||
}
|
||||
}
|
||||
|
||||
barePath := path.Join(setting.RepoRootPath, "git-bare.zip")
|
||||
if !com.IsExist(barePath) {
|
||||
data, err := bin.Asset("conf/content/git-bare.zip")
|
||||
if err != nil {
|
||||
log.Fatal("Fail to get asset 'git-bare.zip': %v", err)
|
||||
} else if err := ioutil.WriteFile(barePath, data, os.ModePerm); err != nil {
|
||||
log.Fatal("Fail to write asset 'git-bare.zip': %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -381,7 +390,7 @@ func CreateRepository(user *User, name, desc, lang, license string, private, mir
|
||||
|
||||
// extractGitBareZip extracts git-bare.zip to repository path.
|
||||
func extractGitBareZip(repoPath string) error {
|
||||
z, err := zip.Open("conf/content/git-bare.zip")
|
||||
z, err := zip.Open(path.Join(setting.RepoRootPath, "git-bare.zip"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ func ZipDownload(ctx *middleware.Context, params martini.Params) {
|
||||
commitId := ctx.Repo.CommitId
|
||||
archivesPath := filepath.Join(ctx.Repo.GitRepo.Path, "archives/zip")
|
||||
if !com.IsDir(archivesPath) {
|
||||
if err := os.MkdirAll(archivesPath, 0655); err != nil {
|
||||
if err := os.MkdirAll(archivesPath, 0755); err != nil {
|
||||
ctx.Handle(500, "ZipDownload -> os.Mkdir(archivesPath)", err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.4.0.0531 Alpha
|
||||
0.4.1.0601 Alpha
|
||||
Reference in New Issue
Block a user