git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[QUESTION]: How to get uploading git objects via a git command in a pre-receive-hook

From
ZheNing Hu <adlternative@gmail.com>
Date
Jun 29, 2024, 14:42 UTC
Message-ID
<CAOLTT8Sb4+_L7TrP8zZvvSqFu0MqbDanOhi6jfxfRLQKRimYzw@mail.gmail.com>
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?

Thanks. -- ZheNing Hu

Next: Christian Couder
Message 1 of 3 in “[QUESTION]: How to get uploading git objects via a git command in a pre-receive-hook”
  1. ZheNing HuJun 29, 2024
  2. Christian CouderJun 29, 2024
  3. Jeff KingJul 1, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.