aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/object.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-01-09 09:50:29 +0100
committerGitHub <noreply@github.com>2017-01-09 09:50:29 +0100
commit0c6c986ddd9855c8fd5f28771f824d7da73d4dc3 (patch)
treee1927c59b94fa14e52ccc51daa3a9b7d8e4670fa /plumbing/object/object.go
parent841abfb7dc640755c443432064252907e3e55c95 (diff)
downloadgo-git-0c6c986ddd9855c8fd5f28771f824d7da73d4dc3.tar.gz
plumbing: fix signature with `>` before `<` parsing (#204)
Diffstat (limited to 'plumbing/object/object.go')
-rw-r--r--plumbing/object/object.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/plumbing/object/object.go b/plumbing/object/object.go
index 8bdbb2a..faf7e7f 100644
--- a/plumbing/object/object.go
+++ b/plumbing/object/object.go
@@ -83,12 +83,16 @@ type Signature struct {
// Decode decodes a byte slice into a signature
func (s *Signature) Decode(b []byte) {
- open := bytes.IndexByte(b, '<')
- close := bytes.IndexByte(b, '>')
+ open := bytes.LastIndexByte(b, '<')
+ close := bytes.LastIndexByte(b, '>')
if open == -1 || close == -1 {
return
}
+ if close < open {
+ return
+ }
+
s.Name = string(bytes.Trim(b[:open], " "))
s.Email = string(b[open+1 : close])