diff --git a/cmd/precommit/main.go b/cmd/precommit/main.go index ac2f3047..c79ecd77 100644 --- a/cmd/precommit/main.go +++ b/cmd/precommit/main.go @@ -330,7 +330,7 @@ func stagedLFSOID(ctx context.Context, path string) (string, bool, error) { hex := strings.TrimPrefix(line, "oid sha256:") hex = strings.TrimSpace(hex) if hex != "" { - oid = "sha256:" + hex + oid = hex } // keep scanning a bit in case spec is below (rare), but we can break once both are found. } diff --git a/cmd/precommit/main_test.go b/cmd/precommit/main_test.go index 8a0fb0c6..4da82ab5 100644 --- a/cmd/precommit/main_test.go +++ b/cmd/precommit/main_test.go @@ -93,11 +93,11 @@ func TestHandleUpsertWritesLFSPointerCache(t *testing.T) { if pathCache.Path != "data/file.bin" { t.Fatalf("expected path entry to be data/file.bin, got %q", pathCache.Path) } - if pathCache.LFSOID != "sha256:deadbeef" { - t.Fatalf("expected lfs oid sha256:deadbeef, got %q", pathCache.LFSOID) + if pathCache.LFSOID != "deadbeef" { + t.Fatalf("expected lfs oid deadbeef, got %q", pathCache.LFSOID) } - oidEntry := oidEntryFile(oidsDir, "sha256:deadbeef") + oidEntry := oidEntryFile(oidsDir, "deadbeef") oidData, err := os.ReadFile(oidEntry) if err != nil { t.Fatalf("read oid entry: %v", err) @@ -106,8 +106,8 @@ func TestHandleUpsertWritesLFSPointerCache(t *testing.T) { if err := json.Unmarshal(oidData, &oidCache); err != nil { t.Fatalf("unmarshal oid entry: %v", err) } - if oidCache.LFSOID != "sha256:deadbeef" { - t.Fatalf("expected oid entry sha256:deadbeef, got %q", oidCache.LFSOID) + if oidCache.LFSOID != "deadbeef" { + t.Fatalf("expected oid entry deadbeef, got %q", oidCache.LFSOID) } if len(oidCache.Paths) != 1 || oidCache.Paths[0] != "data/file.bin" { t.Fatalf("expected oid paths to include data/file.bin, got %v", oidCache.Paths)