git-tweezers
Version:
Advanced git staging tool with hunk and line-level control
22 lines (21 loc) • 809 B
TypeScript
import type { ExtendedLineChange } from '../types/extended-diff.js';
export interface HunkData {
header: string;
changes: ExtendedLineChange[];
}
export interface FileData {
oldPath: string;
newPath: string;
hunks: HunkData[];
}
export declare class PatchBuilder {
buildPatch(files: FileData[]): string;
buildHunkPatch(file: FileData, hunkIndex: number): string | null;
buildLinePatch(file: FileData, selectedExtendedLineChanges: ExtendedLineChange[], originalHunk: HunkData): string;
rebuildHunk(originalHunk: HunkData, selectedExtendedLineChanges: ExtendedLineChange[]): HunkData;
private formatLineChange;
/**
* Calculate hunk header from changes
*/
calculateHunkHeader(changes: ExtendedLineChange[], oldStart: number, newStart: number): string;
}