From e04c97b9fa3a9955e967a918aada9b21a78a0ec6 Mon Sep 17 00:00:00 2001
From: Arthur Ouyang <arthur.oy+github@gmail.com>
Date: Thu, 19 Nov 2015 07:31:55 +0800
Subject: Fix #1965 - the hyperlink and the display name of the branch

The hyperlink and the display name of the branch if the branch is in a folder or the branch name has '#'
---
 modules/git/utils.go | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'modules/git')

diff --git a/modules/git/utils.go b/modules/git/utils.go
index 78792aaf..43a4da3d 100644
--- a/modules/git/utils.go
+++ b/modules/git/utils.go
@@ -35,6 +35,10 @@ func parsePrettyFormatLog(repo *Repository, logByts []byte) (*list.List, error)
 }
 
 func RefEndName(refStr string) string {
+	if strings.HasPrefix(refStr, "refs/heads/") {
+		return strings.TrimPrefix(refStr, "refs/heads/")
+	}
+
 	index := strings.LastIndex(refStr, "/")
 	if index != -1 {
 		return refStr[index+1:]
-- 
cgit v1.2.3


From 0bd4d15e4722e77a858a2683c0583ac2f53c633b Mon Sep 17 00:00:00 2001
From: Arthur Ouyang <arthur.oy+github@gmail.com>
Date: Thu, 19 Nov 2015 08:05:27 +0800
Subject: Use refStr[11:] instead of TrimPrefix

Fix #1965
---
 modules/git/utils.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'modules/git')

diff --git a/modules/git/utils.go b/modules/git/utils.go
index 43a4da3d..73d32d35 100644
--- a/modules/git/utils.go
+++ b/modules/git/utils.go
@@ -36,7 +36,8 @@ func parsePrettyFormatLog(repo *Repository, logByts []byte) (*list.List, error)
 
 func RefEndName(refStr string) string {
 	if strings.HasPrefix(refStr, "refs/heads/") {
-		return strings.TrimPrefix(refStr, "refs/heads/")
+		// trim the "refs/heads/"
+		return return refStr[11:]
 	}
 
 	index := strings.LastIndex(refStr, "/")
-- 
cgit v1.2.3


From fc56f42dc35a60395ca8def114a23a6c7655c410 Mon Sep 17 00:00:00 2001
From: Arthur Ouyang <arthur.oy+github@gmail.com>
Date: Thu, 19 Nov 2015 08:10:44 +0800
Subject: Use refStr[len("refs/heads/"):] instead of refStr[11:] and fix error

Fix #1965
---
 modules/git/utils.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'modules/git')

diff --git a/modules/git/utils.go b/modules/git/utils.go
index 73d32d35..d2d0c19e 100644
--- a/modules/git/utils.go
+++ b/modules/git/utils.go
@@ -37,7 +37,7 @@ func parsePrettyFormatLog(repo *Repository, logByts []byte) (*list.List, error)
 func RefEndName(refStr string) string {
 	if strings.HasPrefix(refStr, "refs/heads/") {
 		// trim the "refs/heads/"
-		return return refStr[11:]
+		return refStr[len("refs/heads/"):]
 	}
 
 	index := strings.LastIndex(refStr, "/")
-- 
cgit v1.2.3