From 104aa23a9ed5ac01377eda1e421f1f3f43163c99 Mon Sep 17 00:00:00 2001
From: Lunny Xiao <xiaolunwen@gmail.com>
Date: Thu, 20 Feb 2014 17:52:07 +0800
Subject: [PATCH] improved ssh supports

---
 conf/app.ini   | 2 +-
 models/repo.go | 2 +-
 serve.go       | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/conf/app.ini b/conf/app.ini
index 0003ad0325..517660addd 100644
--- a/conf/app.ini
+++ b/conf/app.ini
@@ -2,7 +2,7 @@ APP_NAME = Gogs - Go Git Service
 RUN_USER = git
 
 [repository]
-ROOT = /home/git/gogs-repositories
+ROOT = /Users/lunny/git/gogs-repositories
 
 [server]
 HTTP_ADDR = 
diff --git a/models/repo.go b/models/repo.go
index 27807303f9..527b7a91de 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -34,7 +34,7 @@ func IsRepositoryExist(user *User, reposName string) (bool, error) {
 	if err != nil {
 		return has, err
 	}
-	s, err := os.Stat(filepath.Join(RepoRootPath, user.Name, reposName))
+	s, err := os.Stat(RepoPath(user.Name, reposName))
 	if err != nil {
 		return false, nil
 	}
diff --git a/serve.go b/serve.go
index 6b4caa1dd7..b0e258e3f4 100644
--- a/serve.go
+++ b/serve.go
@@ -65,7 +65,7 @@ func runServ(*cli.Context) {
 		return
 	}
 
-	println(cmd)
+	//println(cmd)
 
 	verb, args := parseCmd(cmd)
 	rr := strings.SplitN(strings.Trim(args, "'"), "/", 2)
@@ -80,13 +80,13 @@ func runServ(*cli.Context) {
 	isWrite := In(verb, COMMANDS_WRITE)
 	isRead := In(verb, COMMANDS_READONLY)
 
-	println("repoPath:", models.RepoPath(user.Name, repoName))
+	//println("repoPath:", models.RepoPath(user.Name, repoName))
 
 	switch {
 	case isWrite:
 		has, err := models.HasAccess(user.Name, repoName, COMMANDS_WRITE[verb])
 		if err != nil {
-			fmt.Println("Inernel error")
+			fmt.Println("Inernel error:", err)
 			return
 		}
 		if !has {
@@ -136,7 +136,7 @@ func runServ(*cli.Context) {
 
 	fullPath := models.RepoPath(user.Name, repoName)
 	newcmd := fmt.Sprintf("%s '%s'", verb, fullPath)
-	println(newcmd)
+	//println(newcmd)
 	gitcmd := exec.Command("git", "shell", "-c", newcmd)
 	gitcmd.Stdout = os.Stdout
 	gitcmd.Stderr = os.Stderr