Skip to content

Conversation

@asmundg
Copy link
Member

@asmundg asmundg commented May 6, 2022

If we know that a file was added in a range of commits (typically
something like origin/main..HEAD), we don't need to search the entire
repo history for the file. This can yield significant speedups in large
repos.

asmundg added 2 commits May 6, 2022 09:11
If we know that a file was added in a range of commits (typically
something like origin/main..HEAD), we don't need to search the entire
repo history for the file. This can yield significant speedups in large
repos.
*/
export function getFileAddedHash(filename: string, cwd: string) {
const results = git(["rev-list", "HEAD", filename], { cwd });
export function getFileAddedHash(filename: string, cwd: string, fromRef?: string, toRef?: string) {
Copy link
Member

@ecraig12345 ecraig12345 Jul 21, 2022

Choose a reason for hiding this comment

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

I think it might be better to combine these in a single parameter, like range?: { fromRef: string; toRef: string }. That way it's clear that both fromRef and toRef are required, and (in some sense) reduces signature bloat.

Copy link
Member

Choose a reason for hiding this comment

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

Also, if you merge/rebase this, the function moved to src/git/gitUtilities.ts.

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