Replace isomorphic-git with direct git calls#108
Open
bluwy wants to merge 1 commit into
Open
Conversation
Andarist
approved these changes
Jun 14, 2026
| return { additions, deletions }; | ||
| } | ||
|
|
||
| async function getOidForRef(ref: string, cwd: string): Promise<string | null> { |
Member
There was a problem hiding this comment.
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
| } | ||
| } | ||
|
|
||
| async function findGitRoot(start: string): Promise<string | null> { |
Member
There was a problem hiding this comment.
If I'm not mistaken, this could be git rev-parse --git-dir - but this is OK too
Comment on lines
+140
to
+142
|
|
||
| additions.sort((a, b) => (a.path > b.path ? 1 : -1)); | ||
| deletions.sort((a, b) => (a.path > b.path ? 1 : -1)); |
Member
There was a problem hiding this comment.
Suggested change
| additions.sort((a, b) => (a.path > b.path ? 1 : -1)); | |
| deletions.sort((a, b) => (a.path > b.path ? 1 : -1)); |
| ); | ||
| } | ||
| // Test executable files | ||
| if (stat.mode & 0o111) { |
Member
There was a problem hiding this comment.
nit: it would be nice to have constants for those - then we wouldn't even need a comment like the one above this check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor
git.tsto use thegit diffandgit ls-filescommands to get the changed files, rather thanisomorphic-git.This uses a different technique to before, but should achieve the same result (which is covered by tests).
git diffand get untracked file additions withgit 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.logfrom isomorphic-git to a simplegit rev-parsecommand. Later I think we can try not needing this at all and detect the error ingetFileChangesdirectly.