32

I’m wondering that git clone --verbose is not very verbose. The output of executing the command is the following:

$ git clone --verbose <repo>
remote: Counting objects: 184, done
remote: Finding sources: 100% (184/184)
remote: Total 184 (delta 66), reused 183 (delta 66)
Receiving objects: 100% (184/184), 18.90 KiB, done.
Resolving deltas: 100% (66/66), done. 

The expected behaviour is to see the list of the received objects one by one. Is that possible using some other options?

Rory O'Kane
  • 29,210
  • 11
  • 96
  • 131
erkfel
  • 1,588
  • 2
  • 17
  • 29
  • Fun fact - if `git` indeed did report each object one-by-one as you propose, then a `git clone` of the Linux kernel repository would produce well over 2 million lines of output. Probably a good reason it's not implemented that way... If you really want that information, you can try `git rev-list --objects --all`... – twalberg Jul 11 '13 at 17:56
  • I see, do you know is that "git rev-list --objects --all" provide the same order of the objects that is "git clone" for "Receiving objects"? I need that because I'm sometimes getting the network error on receiving one of the obejcts and I want to fidn exactly this object in the tree. – erkfel Jul 11 '13 at 18:05
  • I would be extremely surprised if your "network error" was in any way related to a specific object currently being transferred over a TCP socket. The order is likely not the same, as `git` is generating and sending a pack file that contains the requested objects, and the order objects get placed into a pack file can seem somewhat arbitrary. – twalberg Jul 11 '13 at 18:14
  • In this case how git determine how many objects already downloaded? In the "Receiving objects" it write exact number of objects that was already downloaded. – erkfel Jul 11 '13 at 18:50
  • The client side essentially runs `git rev-list --objects --all` (which will be empty on an initial clone) and sends that list to the server. The server generates a similar list based on its repository, and subtracts out the stuff that the client already has, then generates a pack file based on what is left in the list - the stuff the client doesn't have yet. However, generating the pack file can reorder that list in order to try to minimize the size of the pack file. – twalberg Jul 11 '13 at 19:38
  • Related question: 2011-05-30, [*How can I debug git/git-shell related problems?*](https://stackoverflow.com/questions/6178401/how-can-i-debug-git-git-shell-related-problems) (They list a lot of debug parameters there.) – StackzOfZtuff Jan 15 '16 at 08:12

2 Answers2

26

I accept @Lekensteyn answer.

If you want to trace git remote commands,add following environmental variables into your terminal.This helps you to peek into what is running behind the scenes of a git command.

export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1

Reference:https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables

Sample Cloning Result after exportenter image description here

enter image description here

enter image description here enter image description here

Nayagam
  • 1,767
  • 18
  • 12
17

It is not possible to list objects (files, commits, blobs, whatever) one-by-one, simply because git packs them in a single file for efficiency reasons. For the same reason, you will only see a hidden .git folder while cloning, files will be created only if the full pack file has been downloaded.

If you are wondering, these pack files will be downloaded to .git/objects/pack/ with a name like tmp_pack_XXXXXX. (later on, it will be renamed to something like pack-*.pack with a related pack-*.idx file)

Lekensteyn
  • 64,486
  • 22
  • 159
  • 192