summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-17 17:00:35 -0400
committerUnknown <joe2010xtmf@163.com>2014-03-17 17:00:35 -0400
commite656609b0d7780103fbed4472a6d6bef9a6d64d0 (patch)
treec1019a36c14018b333f360d9256b501d074dfb9d /models
parent6ca32ef44f3ca127b930b98e5192ab5a21f5d454 (diff)
downloadgitea-e656609b0d7780103fbed4472a6d6bef9a6d64d0.tar.gz
gitea-e656609b0d7780103fbed4472a6d6bef9a6d64d0.zip
Bug fix
Diffstat (limited to 'models')
-rw-r--r--models/publickey.go2
-rw-r--r--models/repo.go16
2 files changed, 16 insertions, 2 deletions
diff --git a/models/publickey.go b/models/publickey.go
index 021d690fb6..092436d55f 100644
--- a/models/publickey.go
+++ b/models/publickey.go
@@ -23,7 +23,7 @@ import (
const (
// "### autogenerated by gitgos, DO NOT EDIT\n"
- TPL_PUBLICK_KEY = `command="%s serv key-%d",no-port-forwarding, no-X11-forwarding,no-agent-forwarding,no-pty %s`
+ TPL_PUBLICK_KEY = `command="%s serv key-%d",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s`
)
var (
diff --git a/models/repo.go b/models/repo.go
index c377747a62..6e3754acf5 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -223,6 +223,17 @@ func initRepository(f string, user *User, repo *Repository, initReadme bool, rep
return err
}
+ // hook/post-update
+ pu, err := os.OpenFile(filepath.Join(repoPath, "hooks", "post-update"), os.O_CREATE|os.O_WRONLY, 0777)
+ if err != nil {
+ return err
+ }
+ defer pu.Close()
+ // TODO: Windows .bat
+ if _, err = pu.WriteString(fmt.Sprintf("#!/usr/bin/env bash\n%s update\n", appPath)); err != nil {
+ return err
+ }
+
// Initialize repository according to user's choice.
fileName := map[string]string{}
if initReadme {
@@ -275,11 +286,14 @@ func initRepository(f string, user *User, repo *Repository, initReadme bool, rep
}
}
+ if len(fileName) == 0 {
+ return nil
+ }
+
// Apply changes and commit.
if err := initRepoCommit(tmpDir, user.NewGitSig()); err != nil {
return err
}
-
return nil
}