Re: [QUESTION]: How to get uploading git objects via a git command in a pre-receive-hook
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Jun 29, 2024, 16:29 UTC
- Message-ID
- <CAP8UFD04cvb8k2ZkUYM20B5ym6e8q=KGL4PEDNF8_4x6G32SnQ@mail.gmail.com>
- In-Reply-To
- <CAOLTT8Sb4+_L7TrP8zZvvSqFu0MqbDanOhi6jfxfRLQKRimYzw@mail.gmail.com>
Hi ZheNing,
On Sat, Jun 29, 2024 at 4:42 PM ZheNing Hu <adlternative@gmail.com> wrote:
Show 12 quoted lines
> > Hi, > > I want to check the uploaded Git LFS objects in the pre-receive hook > of the Git server. Assuming that the Git repository during the upload > process is A.git, my current approach is to create an empty repository > B.git and then use > GIT_ALTERNATE_OBJECT_DIRECTORIES="A.git/objects/tmp_objdir-incoming-**" > followed by executing git -C B.git cat-file --batch-check > --batch-all-objects to obtain the objects being uploaded, then filter > out the LFS objects. This process is very time-consuming, taking > roughly more than 10 seconds. I wonder if there's a simpler method?
I wonder if it's possible to use `git verify-pack --verbose` on the received packfile.
Best, Christian.