summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author无闻 <u@gogs.io>2015-02-09 10:45:41 -0500
committer无闻 <u@gogs.io>2015-02-09 10:45:41 -0500
commit767bf82eabed0fede7bbdb5f5b1c75898c6ff00d (patch)
treecdea12b284619fde82114e77d1f87e1e1f191fd9
parent6ed96b7a20b8b53ef958808cc414d59b72b7fa5c (diff)
parentb7e26aa5e30360897ea51d49f6d977ac0562431d (diff)
downloadgitea-767bf82eabed0fede7bbdb5f5b1c75898c6ff00d.tar.gz
gitea-767bf82eabed0fede7bbdb5f5b1c75898c6ff00d.zip
Merge pull request #923 from phsmit/fix_922
Fix #922
-rw-r--r--cmd/serve.go5
-rw-r--r--models/publickey.go4
-rw-r--r--models/repo.go2
3 files changed, 7 insertions, 4 deletions
diff --git a/cmd/serve.go b/cmd/serve.go
index 28fd40134a..25f7dd9191 100644
--- a/cmd/serve.go
+++ b/cmd/serve.go
@@ -90,7 +90,10 @@ func runServ(k *cli.Context) {
}
setup("serv.log")
- keys := strings.Split(os.Args[2], "-")
+ if len(k.Args()) < 1 {
+ log.GitLogger.Fatal(2, "Not enough arguments")
+ }
+ keys := strings.Split(k.Args()[0], "-")
if len(keys) != 2 {
println("Gogs: auth file format error")
log.GitLogger.Fatal(2, "Invalid auth file format: %s", os.Args[2])
diff --git a/models/publickey.go b/models/publickey.go
index b1c7b62449..383b85b634 100644
--- a/models/publickey.go
+++ b/models/publickey.go
@@ -29,7 +29,7 @@ import (
const (
// "### autogenerated by gitgos, DO NOT EDIT\n"
- _TPL_PUBLICK_KEY = `command="%s serv --config='%s' key-%d",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s` + "\n"
+ _TPL_PUBLICK_KEY = `command="%s serv key-%d --config='%s'",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s` + "\n"
)
var (
@@ -98,7 +98,7 @@ func (k *PublicKey) OmitEmail() string {
// GetAuthorizedString generates and returns formatted public key string for authorized_keys file.
func (key *PublicKey) GetAuthorizedString() string {
- return fmt.Sprintf(_TPL_PUBLICK_KEY, appPath, setting.CustomConf, key.Id, key.Content)
+ return fmt.Sprintf(_TPL_PUBLICK_KEY, appPath, key.Id, setting.CustomConf, key.Content)
}
var (
diff --git a/models/repo.go b/models/repo.go
index f2f10baff0..64c152dd8d 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -30,7 +30,7 @@ import (
)
const (
- _TPL_UPDATE_HOOK = "#!/usr/bin/env %s\n%s update --config='%s' $1 $2 $3\n"
+ _TPL_UPDATE_HOOK = "#!/usr/bin/env %s\n%s update $1 $2 $3 --config='%s'\n"
)
var (