-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Refactor CatFile batch implementation and introduce batch-command for git 2.36 #34651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
f0b6480 to
334eb9e
Compare
… into lunny/catfile_batch_refactor
modules/git/batch.go
Outdated
| func NewBatch(ctx context.Context, repoPath string) (Batch, error) { | ||
| if DefaultFeatures().SupportCatFileBatchCommand { | ||
| return newBatchCommandCatFile(ctx, repoPath) | ||
| } | ||
| return newBatchCatFileWithCheck(ctx, repoPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it is not the first time that I told you that you must have correct tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests added at db4b7e4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I told you to add test but didn't tell you to copy paste unrelated code everywhere.
You need to clearly test NewBatch, but not keeping polluting other tests
|
It's ready to review again. |
For git version 2.36,
git cat-file --batch-commandwas introduced which can replacegit cat-file --batchandgit cat-file --batch-check.This PR implements an abstract layer for the batch commands so that both git 2.36 and lower version git can work.
If git version is lower than 2.36, it will start two subprocesses
git cat-file --batchandgit cat-file --batch-check.If git version is greater than 2.36, only
git cat-file --batch-commandwill be started.This reduced half of child processes of git catfiles.