feat: add diffBranchesStat and diffFileSingle to BranchManager
Adds FileStatEntry type and two new primitives to the BranchManager port and SimpleGitBranchManager adapter, enabling split diff procedures in the tRPC layer without returning raw multi-megabyte diffs. - FileStatEntry captures path, status, additions/deletions, oldPath (renames), and optional projectId for multi-project routing - diffBranchesStat uses --name-status + --numstat, detects binary files (shown as - / - in numstat), handles spaces in filenames - diffFileSingle returns raw unified diff for a single file path
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* a worktree to be checked out.
|
||||
*/
|
||||
|
||||
import type { MergeResult, MergeabilityResult, BranchCommit } from './types.js';
|
||||
import type { MergeResult, MergeabilityResult, BranchCommit, FileStatEntry } from './types.js';
|
||||
|
||||
export interface BranchManager {
|
||||
/**
|
||||
@@ -29,6 +29,22 @@ export interface BranchManager {
|
||||
*/
|
||||
diffBranches(repoPath: string, baseBranch: string, headBranch: string): Promise<string>;
|
||||
|
||||
/**
|
||||
* Get per-file metadata for changes between two branches.
|
||||
* Uses three-dot diff (baseBranch...headBranch) — same divergence model as diffBranches.
|
||||
* Binary files are included with status 'binary' and additions/deletions both 0.
|
||||
* Does NOT return hunk content.
|
||||
*/
|
||||
diffBranchesStat(repoPath: string, baseBranch: string, headBranch: string): Promise<FileStatEntry[]>;
|
||||
|
||||
/**
|
||||
* Get the raw unified diff for a single file between two branches.
|
||||
* Uses three-dot diff (baseBranch...headBranch).
|
||||
* Returns empty string for binary files (caller must detect binary separately).
|
||||
* filePath must be URL-decoded before being passed here.
|
||||
*/
|
||||
diffFileSingle(repoPath: string, baseBranch: string, headBranch: string, filePath: string): Promise<string>;
|
||||
|
||||
/**
|
||||
* Delete a branch. No-op if the branch doesn't exist.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user