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

Re: Seems to be pushing more than necessary

From
Duy Nguyen <pclouds@gmail.com>
Date
Mar 18, 2015, 12:26 UTC
Message-ID
<CACsJy8AFi8-EgUJNr+KTOngeUaGfi_O5f_=qba08qJs1jcEj=w@mail.gmail.com>
In-Reply-To
<CAABECY2_A83tWaqb_6YzXwr0Tv5AYVq0KW70j+EHqrx69k2P_A@mail.gmail.com>
On Wed, Mar 18, 2015 at 7:03 PM, Graham Hay <grahamrhay@gmail.com> wrote:
> Are there any commands that I can use to show exactly what it is trying to push?

It's a bit more than a command. If you push when GIT_TRACE is set to 2, you'll see it executes "git pack-objects" command with all its arguments. This command expects some input from stdin. If you can capture that, you can run it by yourself to create the exact pack that is transferred over network. Run that pack through "git index-pack --verify-stat" will show you SHA-1 of all sent objects.

It's quite a lot of work :) I created this script named "git" and put it in $PATH to capture input for pack-objects. You'll need to update "/path/to/real/git" to point to the real binary then you'll get /tmp/stdin

-- 8< -- #!/bin/sh

if [ "$1" = pack-objects ]; then exec tee /tmp/stdin | /path/to/real/git "$@" else exec /path/to/real/git "$@" fi -- 8< --

The remaining steps may be this (may need tweaking)

git pack-objects '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress' < /tmp/stdin | git index-pack --fix-thin --stdin pack 708538afeda8eb331858680e227f7713228ce782 <-- new pack git verify-pack --verbose .git/objects/pack/pack-708538afeda8eb331858680e227f7713228ce782.pack d75631bd83ebdf03d4b0d925ff6734380f801fc6 commit 567 377 12 dd44100a7cdad113b23d31876e469b74fbe21e1b tree 15069 10492 389 8f4bbccea759d7a47616e29bd55b3f205b3615c2 tree 3869 2831 10881 3db0460935bc843a2a70a0e087222eec61a0ff0d blob 12379 3529 13712

Here we can see this push of mine sends four objects, 1 commit, 2 trees and 1 blob.

-- 
Duy
Previous: Graham HayNext: Duy Nguyen
Message 6 of 17 in “Fwd: Seems to be pushing more than necessary”
  1. Graham HayMar 18, 2015
  2. Duy NguyenMar 18, 2015
  3. Graham HayMar 18, 2015
  4. Duy NguyenMar 18, 2015
  5. Graham HayMar 18, 2015
  6. Duy NguyenMar 18, 2015
  7. Duy NguyenMar 18, 2015
  8. Graham HayMar 18, 2015
  9. Duy NguyenMar 18, 2015
  10. Graham HayMar 18, 2015
  11. Duy NguyenMar 19, 2015
  12. Junio C HamanoMar 19, 2015
  13. Graham HayMar 20, 2015
  14. Duy NguyenMar 23, 2015
  15. Graham HayMar 23, 2015
  16. Duy NguyenMar 23, 2015
  17. Graham HayMar 23, 2015

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.