aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd/cert.go12
-rw-r--r--cmd/cmd.go42
-rw-r--r--cmd/dump.go4
-rw-r--r--cmd/serve.go2
-rw-r--r--cmd/update.go2
-rw-r--r--cmd/web.go4
-rw-r--r--models/action.go4
-rw-r--r--modules/ssh/ssh.go1
8 files changed, 59 insertions, 12 deletions
diff --git a/cmd/cert.go b/cmd/cert.go
index 5b182da9e0..7b68f330ec 100644
--- a/cmd/cert.go
+++ b/cmd/cert.go
@@ -32,12 +32,12 @@ var CmdCert = cli.Command{
Outputs to 'cert.pem' and 'key.pem' and will overwrite existing files.`,
Action: runCert,
Flags: []cli.Flag{
- cli.StringFlag{"host", "", "Comma-separated hostnames and IPs to generate a certificate for", ""},
- cli.StringFlag{"ecdsa-curve", "", "ECDSA curve to use to generate a key. Valid values are P224, P256, P384, P521", ""},
- cli.IntFlag{"rsa-bits", 2048, "Size of RSA key to generate. Ignored if --ecdsa-curve is set", ""},
- cli.StringFlag{"start-date", "", "Creation date formatted as Jan 1 15:04:05 2011", ""},
- cli.DurationFlag{"duration", 365 * 24 * time.Hour, "Duration that certificate is valid for", ""},
- cli.BoolFlag{"ca", "whether this cert should be its own Certificate Authority", ""},
+ stringFlag("host", "", "Comma-separated hostnames and IPs to generate a certificate for"),
+ stringFlag("ecdsa-curve", "", "ECDSA curve to use to generate a key. Valid values are P224, P256, P384, P521"),
+ intFlag("rsa-bits", 2048, "Size of RSA key to generate. Ignored if --ecdsa-curve is set"),
+ stringFlag("start-date", "", "Creation date formatted as Jan 1 15:04:05 2011"),
+ durationFlag("duration", 365*24*time.Hour, "Duration that certificate is valid for"),
+ boolFlag("ca", "whether this cert should be its own Certificate Authority"),
},
}
diff --git a/cmd/cmd.go b/cmd/cmd.go
new file mode 100644
index 0000000000..8df02d5c7e
--- /dev/null
+++ b/cmd/cmd.go
@@ -0,0 +1,42 @@
+// Copyright 2015 The Gogs Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package cmd
+
+import (
+ "time"
+
+ "github.com/codegangsta/cli"
+)
+
+func stringFlag(name, value, usage string) cli.StringFlag {
+ return cli.StringFlag{
+ Name: name,
+ Value: value,
+ Usage: usage,
+ }
+}
+
+func boolFlag(name, usage string) cli.BoolFlag {
+ return cli.BoolFlag{
+ Name: name,
+ Usage: usage,
+ }
+}
+
+func intFlag(name string, value int, usage string) cli.IntFlag {
+ return cli.IntFlag{
+ Name: name,
+ Value: value,
+ Usage: usage,
+ }
+}
+
+func durationFlag(name string, value time.Duration, usage string) cli.DurationFlag {
+ return cli.DurationFlag{
+ Name: name,
+ Value: value,
+ Usage: usage,
+ }
+}
diff --git a/cmd/dump.go b/cmd/dump.go
index 44b180c32b..0bf385d065 100644
--- a/cmd/dump.go
+++ b/cmd/dump.go
@@ -25,8 +25,8 @@ var CmdDump = cli.Command{
It can be used for backup and capture Gogs server image to send to maintainer`,
Action: runDump,
Flags: []cli.Flag{
- cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
- cli.BoolFlag{"verbose, v", "show process details", ""},
+ stringFlag("config, c", "custom/conf/app.ini", "Custom configuration file path"),
+ boolFlag("verbose, v", "show process details"),
},
}
diff --git a/cmd/serve.go b/cmd/serve.go
index b571375257..b6ab9bb860 100644
--- a/cmd/serve.go
+++ b/cmd/serve.go
@@ -33,7 +33,7 @@ var CmdServ = cli.Command{
Description: `Serv provide access auth for repositories`,
Action: runServ,
Flags: []cli.Flag{
- cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
+ stringFlag("config, c", "custom/conf/app.ini", "Custom configuration file path"),
},
}
diff --git a/cmd/update.go b/cmd/update.go
index 289aedbf61..4cd62a7f54 100644
--- a/cmd/update.go
+++ b/cmd/update.go
@@ -20,7 +20,7 @@ var CmdUpdate = cli.Command{
Description: `Update get pushed info and insert into database`,
Action: runUpdate,
Flags: []cli.Flag{
- cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
+ stringFlag("config, c", "custom/conf/app.ini", "Custom configuration file path"),
},
}
diff --git a/cmd/web.go b/cmd/web.go
index 950c3d48cf..dabea0ba5a 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -56,8 +56,8 @@ var CmdWeb = cli.Command{
and it takes care of all the other things for you`,
Action: runWeb,
Flags: []cli.Flag{
- cli.StringFlag{"port, p", "3000", "Temporary port number to prevent conflict", ""},
- cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
+ stringFlag("port, p", "3000", "Temporary port number to prevent conflict"),
+ stringFlag("config, c", "custom/conf/app.ini", "Custom configuration file path"),
},
}
diff --git a/models/action.go b/models/action.go
index bb15d4a3d8..8dd80074bd 100644
--- a/models/action.go
+++ b/models/action.go
@@ -418,6 +418,10 @@ func CommitRepoAction(
isNewBranch = true
}
+ // NOTE: limit to detect latest 100 commits.
+ if len(commit.Commits) > 100 {
+ commit.Commits = commit.Commits[len(commit.Commits)-100:]
+ }
if err = updateIssuesCommit(u, repo, repoUserName, repoName, commit.Commits); err != nil {
log.Error(4, "updateIssuesCommit: %v", err)
}
diff --git a/modules/ssh/ssh.go b/modules/ssh/ssh.go
index 706f5e7503..fec43b7901 100644
--- a/modules/ssh/ssh.go
+++ b/modules/ssh/ssh.go
@@ -83,6 +83,7 @@ func handleServerConn(keyID string, chans <-chan ssh.NewChannel) {
return
}
+ // FIXME: check timeout
if err = cmd.Start(); err != nil {
log.Error(3, "Start: %v", err)
return