Skip to content

fix: path resolution, wasted git call, getConflictStatus perf#4

Open
sulthonzh wants to merge 1 commit into
mainfrom
fix/round3-path-resolution-perf
Open

fix: path resolution, wasted git call, getConflictStatus perf#4
sulthonzh wants to merge 1 commit into
mainfrom
fix/round3-path-resolution-perf

Conversation

@sulthonzh

Copy link
Copy Markdown
Owner

What's wrong on main

Bug: path resolution uses CWD instead of workingDir

ConflictResolver resolves file paths with resolve(filePath) which uses process.cwd(). But GitOperations has a workingDir that can differ from CWD. When run from a different directory than the git repo root, validateResolution, openInEditor, and getConflictCount all fail to find the files.

Bug: wasted git.status() call

getConflictedFiles() calls this.git.status() then throws away the result — pure waste (one process spawn for nothing).

Perf: getConflictStatus makes 3+ git calls

getConflictStatus() calls getConflictedFiles() + getMergeInfo()getCurrentBranch()git.status(). That's at minimum 3 separate git process invocations that could be consolidated.

Fixes

  • ConflictResolver now accepts optional cwd param and resolves all paths via resolve(this.workingDir, filePath)
  • Removed the dead git.status() call from getConflictedFiles()
  • getConflictStatus() inlined: single git.status() + single git.diff() + reads merge state files directly

Complements

This PR is independent of and builds on PRs #2 and #3 (which fix editor splitting, conflict detection, abort handling, and rebase context).

…l, optimize getConflictStatus

- ConflictResolver now accepts cwd and resolves all file paths relative
  to workingDir instead of CWD — fixes file-not-found when run from a
  directory different from the git repo root
- GitOperations.getConflictedFiles() no longer makes a wasted
  git.status() call whose result was discarded
- getConflictStatus() consolidated: single status call + single diff
  instead of 3 separate git process invocations (getConflictedFiles +
  getMergeInfo → getCurrentBranch → git.status)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant