mirror of
https://github.com/stablyai/orca.git
synced 2026-09-23 08:02:31 +00:00
* oom(01): A1-shared-readers — reintroduce #10179 subset Files: 18 applied, 0 deleted (from6eb70d8370) Co-authored-by: Orca <help@stably.ai> * oom(02): A2-shared-image-media — reintroduce #10179 subset Files: 7 applied, 0 deleted (from6eb70d8370) Co-authored-by: Orca <help@stably.ai> * oom(03): A3-shared-fs-listing — reintroduce #10179 subset Files: 21 applied, 0 deleted (from6eb70d8370) Co-authored-by: Orca <help@stably.ai> * oom(04): A4-shared-remote-relay — reintroduce #10179 subset Files: 8 applied, 0 deleted (from6eb70d8370) Co-authored-by: Orca <help@stably.ai> * oom(05): A5-shared-misc — reintroduce #10179 subset Files: 28 applied, 0 deleted (from6eb70d8370) Co-authored-by: Orca <help@stably.ai> * oom(06): B-shared-wiring — reintroduce #10179 subset Files: 81 applied, 0 deleted (from6eb70d8370) Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Orca <help@stably.ai>
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
export const GIT_CHECK_IGNORE_TIMEOUT_MS = 15_000
|
|
export const GIT_CHECK_IGNORE_STDIN_CHUNK_BYTES = 1024 * 1024
|
|
|
|
export const GIT_CHECK_IGNORE_STDIN_ARGS = [
|
|
'-c',
|
|
'core.quotePath=false',
|
|
'check-ignore',
|
|
'-z',
|
|
'--stdin'
|
|
] as const
|
|
|
|
export function encodeGitCheckIgnorePaths(paths: readonly string[]): string {
|
|
return `${paths.join('\0')}\0`
|
|
}
|
|
|
|
export function splitGitCheckIgnorePathsByStdinBytes(
|
|
paths: readonly string[],
|
|
maxBytes: number = GIT_CHECK_IGNORE_STDIN_CHUNK_BYTES
|
|
): string[][] {
|
|
const encoder = new TextEncoder()
|
|
const chunks: string[][] = []
|
|
let chunk: string[] = []
|
|
let chunkBytes = 0
|
|
for (const path of paths) {
|
|
const pathBytes = encoder.encode(path).byteLength + 1
|
|
if (chunk.length > 0 && chunkBytes + pathBytes > maxBytes) {
|
|
chunks.push(chunk)
|
|
chunk = []
|
|
chunkBytes = 0
|
|
}
|
|
chunk.push(path)
|
|
chunkBytes += pathBytes
|
|
}
|
|
if (chunk.length > 0) {
|
|
chunks.push(chunk)
|
|
}
|
|
return chunks
|
|
}
|
|
|
|
export function parseGitCheckIgnorePaths(stdout: string): string[] {
|
|
const paths: string[] = []
|
|
for (const path of iterateNulDelimitedFields(stdout)) {
|
|
if (path) {
|
|
paths.push(path)
|
|
}
|
|
}
|
|
return paths
|
|
}
|
|
import { iterateNulDelimitedFields } from './nul-delimited-fields'
|