aboutsummaryrefslogtreecommitdiff
path: root/object/commit
diff options
context:
space:
mode:
Diffstat (limited to 'object/commit')
-rw-r--r--object/commit/parse.go2
-rw-r--r--object/commit/roundtrip_test.go4
2 files changed, 6 insertions, 0 deletions
diff --git a/object/commit/parse.go b/object/commit/parse.go
index 090cf356..20353e14 100644
--- a/object/commit/parse.go
+++ b/object/commit/parse.go
@@ -19,6 +19,7 @@ func Parse(body []byte, objectFormat id.ObjectFormat) (*Commit, error) {
i := 0
state := parseStateTree
sawHeaderEnd := false
+
for i < len(body) {
lineStart := i
@@ -32,6 +33,7 @@ func Parse(body []byte, objectFormat id.ObjectFormat) (*Commit, error) {
if len(line) == 0 {
sawHeaderEnd = true
+
break
}
diff --git a/object/commit/roundtrip_test.go b/object/commit/roundtrip_test.go
index eeeb1f69..2987f639 100644
--- a/object/commit/roundtrip_test.go
+++ b/object/commit/roundtrip_test.go
@@ -157,6 +157,7 @@ func assertCommitEqual(t *testing.T, got *commit.Commit, want *commit.Commit) {
if gotHeader.Key != wantHeader.Key {
t.Fatalf("extra header[%d] key = %q, want %q", i, gotHeader.Key, wantHeader.Key)
}
+
if !bytes.Equal(gotHeader.Value, wantHeader.Value) {
t.Fatalf("extra header[%d] value = %q, want %q", i, gotHeader.Value, wantHeader.Value)
}
@@ -169,12 +170,15 @@ func assertSignatureEqual(t *testing.T, name string, got signature.Signature, wa
if !bytes.Equal(got.Name, want.Name) {
t.Fatalf("%s name = %q, want %q", name, got.Name, want.Name)
}
+
if !bytes.Equal(got.Email, want.Email) {
t.Fatalf("%s email = %q, want %q", name, got.Email, want.Email)
}
+
if got.WhenUnix != want.WhenUnix {
t.Fatalf("%s time = %d, want %d", name, got.WhenUnix, want.WhenUnix)
}
+
if got.OffsetMinutes != want.OffsetMinutes {
t.Fatalf("%s offset = %d, want %d", name, got.OffsetMinutes, want.OffsetMinutes)
}