Skip to content
Myr

upload-pack.ts

This file

Path

packages/git/src/upload-pack.ts

29 lines · 784 bytes · TypeScript

Last changed by

Merge build/comments-packages-rest into mainoscabrielbefore adoption38cd503

History of this file

Take it

The walk stopped after 200 commits: lines older than 678c8b8 point at it.

Merge build/comments-packages-rest into mainoscabrielbefore adoption38cd503

lines 1–2why, one step back
1// A request it can't make out still reads, with no commit named, so a read
2// log built on it errs toward a read.

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 3–29why, one step back
3import { CommitSha } from "@repo/protocol/ids";
4import { Array, Option, Schema } from "effect";56import { textLines } from "./pkt-line.ts";78export interface UploadRequest {9 readonly reads: boolean;10 readonly want: Option.Option<CommitSha>;11}1213const WANT = /^want (?<oid>[0-9a-f]{40})(?: |$)/u;1415const asCommit = Schema.decodeOption(CommitSha);1617export const readUpload = (bytes: Uint8Array): UploadRequest => {18 const lines = textLines(bytes);1920 return {21 reads: lines[0] !== "command=ls-refs",22 want: Array.findFirst(lines, (line) =>23 Option.flatMap(24 Option.fromNullishOr(WANT.exec(line)?.groups?.oid),25 asCommit26 )27 ),28 };29};