ref: d0505e1e9ada529331e964664afe6effad8c3140
parent: 8b1de4803dc3e99c8f6b5da2f7a0f5be7568306f
author: Runxi Yu <runxiyu@umich.edu>
date: Sun Mar 29 13:21:26 EDT 2026
object/signed/commit: Fix whitespace
--- a/object/signed/commit/integration_test.go
+++ b/object/signed/commit/integration_test.go
@@ -21,6 +21,7 @@
testRepo := testgit.NewRepo(t, testgit.RepoOptions{ObjectFormat: algo})signDir := t.TempDir()
+
signRoot, err := os.OpenRoot(signDir)
if err != nil { t.Fatalf("os.OpenRoot(%q): %v", signDir, err)@@ -40,6 +41,7 @@
"-C", "runxiyu@umich.edu",
"-f", privateKeyPath,
) //#nosec G204
+
out, err := cmd.CombinedOutput()
if err != nil { t.Fatalf("ssh-keygen generate failed: %v\n%s", err, out)@@ -102,6 +104,7 @@
"-s", signaturePath,
) //#nosec G204
cmd.Stdin = bytes.NewReader(payload)
+
out, err := cmd.CombinedOutput()
if err != nil { t.Fatalf("ssh-keygen verify failed: %v\n%s", err, out)@@ -126,6 +129,7 @@
"-s", signaturePath,
) //#nosec G204
cmd.Stdin = bytes.NewReader(payload)
+
out, err := cmd.CombinedOutput()
if err == nil { t.Fatalf("ssh-keygen verify unexpectedly succeeded:\n%s", out)--- a/object/signed/commit/parse.go
+++ b/object/signed/commit/parse.go
@@ -25,6 +25,7 @@
rel := bytes.IndexByte(body[i:], '\n')
next := len(body)
+
lineEnd := len(body)
if rel >= 0 {lineEnd = i + rel
@@ -63,6 +64,7 @@
for i < len(body) {rel := bytes.IndexByte(body[i:], '\n')
next = len(body)
+
lineEnd = len(body)
if rel >= 0 {lineEnd = i + rel
@@ -70,6 +72,7 @@
}
contStart := i
+
cont := body[contStart:lineEnd]
if len(cont) == 0 || cont[0] != ' ' {break
--- a/object/signed/commit/unit_test.go
+++ b/object/signed/commit/unit_test.go
@@ -40,6 +40,7 @@
}
gotPayload := string(commit.AppendPayload(nil))
+
wantPayload := "" +
"tree 0cfbf08886fca9a91cb753ec8734c84fcbe52c9f\n" +
"parent 9da738312d24ef0a29be2c8c2b6fc5cf7085a293\n" +
@@ -86,6 +87,7 @@
}
gotAlgorithms := commit.Algorithms()
+
wantAlgorithms := []objectid.Algorithm{objectid.AlgorithmSHA1,
objectid.AlgorithmSHA256,
@@ -111,6 +113,7 @@
}
gotPayload := string(commit.AppendPayload(nil))
+
wantPayload := "" +
"tree deadbeef\n" +
"\n" +
@@ -142,6 +145,7 @@
}
gotPayload := string(commit.AppendPayload(nil))
+
wantPayload := "" +
"tree deadbeef\n" +
"\n" +
--
⑨