Skip to content

Commit b924465

Browse files
committed
Merge pull request #6 from joshfng/fix-refendname
Fix to allow tags with '/' to be returned correctly
2 parents 3c8c495 + 8b98705 commit b924465

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

git.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"time"
1111
)
1212

13-
const _VERSION = "0.2.4"
13+
const _VERSION = "0.2.5"
1414

1515
func Version() string {
1616
return _VERSION

utlis.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ func RefEndName(refStr string) string {
8686
return refStr[len("refs/heads/"):]
8787
}
8888

89-
index := strings.LastIndex(refStr, "/")
90-
if index != -1 {
91-
return refStr[index+1:]
89+
if strings.HasPrefix(refStr, "refs/tags/") {
90+
// trim the "refs/heads/"
91+
return refStr[len("refs/tags/"):]
9292
}
93+
9394
return refStr
9495
}

0 commit comments

Comments
 (0)