Skip to content

Replace isomorphic-git with direct git calls#108

Merged
bluwy merged 2 commits into
mainfrom
no-iso-git
Jun 15, 2026
Merged

Replace isomorphic-git with direct git calls#108
bluwy merged 2 commits into
mainfrom
no-iso-git

Conversation

@bluwy

@bluwy bluwy commented Jun 14, 2026

Copy link
Copy Markdown
Member

Refactor git.ts to use the git diff and git ls-files commands to get the changed files, rather than isomorphic-git.

This uses a different technique to before, but should achieve the same result (which is covered by tests).

  • Before (isomorphic-git): Walks the ref worktree and current worktree to build changed files.
  • After (this PR): Generates file diffs with git diff and get untracked file additions with git ls-files, iterate throught the output to build the changed fles.

This new code is slightly more involved, but shouldn't be too hard to read.


Also, I refactored the git.log from isomorphic-git to a simple git rev-parse command. Later I think we can try not needing this at all and detect the error in getFileChanges directly.

Base automatically changed from update-integration to main June 14, 2026 19:10
Andarist
Andarist previously approved these changes Jun 14, 2026
Comment thread src/git.ts Outdated
return { additions, deletions };
}

async function getOidForRef(ref: string, cwd: string): Promise<string | null> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think cwd usually makes more sense as the first param

other than that - perhaps this should be getShaForRef/resolveSha? That's probably a better understood concept than oid and rev-parse should always resolve to a commit sha

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it should be sha, but I followed the naming with oid to be consistent with the other files. I can followup and rename all to sha in another PR.

Comment thread src/git.ts Outdated
Comment thread src/git.ts
Comment thread src/git.ts Outdated
);
}
// Test executable files
if (stat.mode & 0o111) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it would be nice to have constants for those - then we wouldn't even need a comment like the one above this check

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can move this to a named variable, but if you mean using fs.constants, I did look into it but their bits don't actually match 0o111 from what I can tell. 0o111 was what suggested when I look up online.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant just local named variables in this module

@bluwy bluwy added this pull request to the merge queue Jun 15, 2026
Merged via the queue into main with commit 8b5585d Jun 15, 2026
11 checks passed
@bluwy bluwy deleted the no-iso-git branch June 15, 2026 08:04
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.

2 participants