Replace isomorphic-git with direct git calls#108
Conversation
| return { additions, deletions }; | ||
| } | ||
|
|
||
| async function getOidForRef(ref: string, cwd: string): Promise<string | null> { |
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
There was a problem hiding this comment.
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.
| ); | ||
| } | ||
| // Test executable files | ||
| if (stat.mode & 0o111) { |
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I meant just local named variables in this module
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.