-
-
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/gitcmd/command.go
Outdated
// ToTrustCmdArg converts a string (trusted as argument) to CmdArg | ||
// In most cases, it shouldn't be used. Use AddXxx function instead | ||
func ToTrustCmdArg(arg string) internal.CmdArg { | ||
return internal.CmdArg(arg) | ||
} | ||
|
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.
No, you don't need it.
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.
removed at db4b7e4
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
@@ -0,0 +1 @@ | |||
ref: refs/heads/master |
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 don't understand why it needs a new git repo for testing purpose. There are already plenty.
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.
This is for lfs test. There is no test repository for lfs under git/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.
Why it must be under git/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.
removed at 87e12a1
For git version 2.36,
git cat-file --batch-command
was introduced which can replacegit cat-file --batch
andgit 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 --batch
andgit cat-file --batch-check
.If git version is greater than 2.36, only
git cat-file --batch-command
will be started.This reduced half of child processes of git catfiles.