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

Re: Find the size of git push in pre-receive hook

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 4, 2011, 18:01 UTC
Message-ID
<7vaa8bdax2.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1320398420796-6962141.post@n2.nabble.com>
manigandans <etc.mani@gmail.com> writes:
> I want to restrict the size of the push on the git remote repository. How
> can I find the size of the push in pre-receive hook?
You don't.
What are you trying to solve?

The thing is, by the time pre-receive-hook is run, the packs have already been transferred to the destination. Otherwise pre-receive-hook cannot do its primary task of inspecting the history the push is trying to update the refs with and allow or deny the ref updates.

Presumably you could run "git rev-list --objects" between the values of refs before and after the proposed updates, sum up their sizes and reject the push when the push adds too much data for your liking, and the next gc will clean things up, but if your goal is to cap the maximum disk quota including the transient use during the time pre-receive-hook is run, it would not help.

Previous: Magnus BäckNext: Junio C Hamano
Message 3 of 5 in “Find the size of git push in pre-receive hook”
  1. manigandansNov 4, 2011
  2. Magnus BäckNov 4, 2011
  3. Junio C HamanoNov 4, 2011
  4. Junio C HamanoNov 7, 2011
  5. Jeff KingNov 8, 2011

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.