Merge branch 'master' of github.com:gogits/gogs into develop
This commit is contained in:
commit
70d44e9565
4 changed files with 13 additions and 10 deletions
14
cmd/serve.go
14
cmd/serve.go
|
@ -82,7 +82,7 @@ func runServ(c *cli.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(c.Args()) < 1 {
|
if len(c.Args()) < 1 {
|
||||||
fail("Not enough arguments", "Not enough arugments")
|
fail("Not enough arguments", "Not enough arguments")
|
||||||
}
|
}
|
||||||
|
|
||||||
keys := strings.Split(c.Args()[0], "-")
|
keys := strings.Split(c.Args()[0], "-")
|
||||||
|
@ -97,7 +97,7 @@ func runServ(c *cli.Context) {
|
||||||
|
|
||||||
user, err := models.GetUserByKeyId(keyId)
|
user, err := models.GetUserByKeyId(keyId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fail("internal error", "Fail to get user by key ID(%d): %v", keyId, err)
|
fail("internal error", "Failed to get user by key ID(%d): %v", keyId, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := os.Getenv("SSH_ORIGINAL_COMMAND")
|
cmd := os.Getenv("SSH_ORIGINAL_COMMAND")
|
||||||
|
@ -113,7 +113,7 @@ func runServ(c *cli.Context) {
|
||||||
repoPath := strings.Trim(args, "'")
|
repoPath := strings.Trim(args, "'")
|
||||||
rr := strings.SplitN(repoPath, "/", 2)
|
rr := strings.SplitN(repoPath, "/", 2)
|
||||||
if len(rr) != 2 {
|
if len(rr) != 2 {
|
||||||
fail("Invalid repository path", "Invalide repository path: %v", args)
|
fail("Invalid repository path", "Invalid repository path: %v", args)
|
||||||
}
|
}
|
||||||
repoUserName := rr[0]
|
repoUserName := rr[0]
|
||||||
repoName := strings.TrimSuffix(rr[1], ".git")
|
repoName := strings.TrimSuffix(rr[1], ".git")
|
||||||
|
@ -123,7 +123,7 @@ func runServ(c *cli.Context) {
|
||||||
if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
fail("Repository owner does not exist", "Unregistered owner: %s", repoUserName)
|
fail("Repository owner does not exist", "Unregistered owner: %s", repoUserName)
|
||||||
}
|
}
|
||||||
fail("Internal error", "Fail to get repository owner(%s): %v", repoUserName, err)
|
fail("Internal error", "Failed to get repository owner(%s): %v", repoUserName, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
repo, err := models.GetRepositoryByName(repoUser.Id, repoName)
|
repo, err := models.GetRepositoryByName(repoUser.Id, repoName)
|
||||||
|
@ -135,7 +135,7 @@ func runServ(c *cli.Context) {
|
||||||
fail(_ACCESS_DENIED_MESSAGE, "Repository does not exist: %s/%s", repoUser.Name, repoName)
|
fail(_ACCESS_DENIED_MESSAGE, "Repository does not exist: %s/%s", repoUser.Name, repoName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fail("Internal error", "Fail to get repository: %v", err)
|
fail("Internal error", "Failed to get repository: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
requestedMode, has := COMMANDS[verb]
|
requestedMode, has := COMMANDS[verb]
|
||||||
|
@ -171,7 +171,7 @@ func runServ(c *cli.Context) {
|
||||||
gitcmd.Stdin = os.Stdin
|
gitcmd.Stdin = os.Stdin
|
||||||
gitcmd.Stderr = os.Stderr
|
gitcmd.Stderr = os.Stderr
|
||||||
if err = gitcmd.Run(); err != nil {
|
if err = gitcmd.Run(); err != nil {
|
||||||
fail("Internal error", "Fail to execute git command: %v", err)
|
fail("Internal error", "Failed to execute git command: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if requestedMode == models.ACCESS_MODE_WRITE {
|
if requestedMode == models.ACCESS_MODE_WRITE {
|
||||||
|
@ -184,7 +184,7 @@ func runServ(c *cli.Context) {
|
||||||
err = models.Update(task.RefName, task.OldCommitId, task.NewCommitId,
|
err = models.Update(task.RefName, task.OldCommitId, task.NewCommitId,
|
||||||
user.Name, repoUserName, repoName, user.Id)
|
user.Name, repoUserName, repoName, user.Id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.GitLogger.Error(2, "Fail to update: %v", err)
|
log.GitLogger.Error(2, "Failed to update: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ func (f *AddEmailForm) Validate(ctx *macaron.Context, errs binding.Errors) bindi
|
||||||
}
|
}
|
||||||
|
|
||||||
type ChangePasswordForm struct {
|
type ChangePasswordForm struct {
|
||||||
OldPassword string `form:"old_password" binding:"Required;MinSize(6);MaxSize(255)"`
|
OldPassword string `form:"old_password" binding:"Required;MinSize(1);MaxSize(255)"`
|
||||||
Password string `form:"password" binding:"Required;MinSize(6);MaxSize(255)"`
|
Password string `form:"password" binding:"Required;MinSize(6);MaxSize(255)"`
|
||||||
Retype string `form:"retype"`
|
Retype string `form:"retype"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,6 +152,7 @@ func ShowSSHKeys(ctx *middleware.Context, uid int64) {
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
for i := range keys {
|
for i := range keys {
|
||||||
buf.WriteString(keys[i].OmitEmail())
|
buf.WriteString(keys[i].OmitEmail())
|
||||||
|
buf.WriteString("\n")
|
||||||
}
|
}
|
||||||
ctx.RenderData(200, buf.Bytes())
|
ctx.RenderData(200, buf.Bytes())
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,10 +49,12 @@ do_start()
|
||||||
# 1 if daemon was already running
|
# 1 if daemon was already running
|
||||||
# 2 if daemon could not be started
|
# 2 if daemon could not be started
|
||||||
sh -c "start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\
|
sh -c "start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\
|
||||||
--exec $DAEMON -- $DAEMON_ARGS --test > /dev/null \\
|
--test --chdir $WORKINGDIR --chuid $USER \\
|
||||||
|
--exec $DAEMON -- $DAEMON_ARGS > /dev/null \\
|
||||||
|| return 1"
|
|| return 1"
|
||||||
sh -c "start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\
|
sh -c "start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\
|
||||||
--background --exec /bin/su -- - $USER -c \"cd \\\"$WORKINGDIR\\\" && $DAEMON -- $DAEMON_ARGS\" \\
|
--background --chdir $WORKINGDIR --chuid $USER \\
|
||||||
|
--exec $DAEMON -- $DAEMON_ARGS \\
|
||||||
|| return 2"
|
|| return 2"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue