Compare commits

..

5 Commits

Author SHA1 Message Date
Unknown
afc6cbc479 Update tag 2014-06-01 11:06:03 -04:00
Unknown
1f059502dc Merge branch 'master' of github.com:gogits/gogs into dev 2014-06-01 10:54:15 -04:00
Unknown
01a516b584 Fix #229 2014-06-01 10:53:57 -04:00
无闻
48c98c92c8 Merge pull request #228 from janoliver/patch-1
Fixed directory permissions for the zip download router
2014-06-01 10:42:47 -04:00
Jan Oliver Oelerich
6fe43eb8d4 Fixed directory permissions for the zip download router
If the archives/ directory is created with 0655, it results in a permission error.
2014-06-01 15:22:13 +02:00
4 changed files with 17 additions and 8 deletions

View File

@@ -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())

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -1 +1 @@
0.4.0.0531 Alpha
0.4.1.0601 Alpha