1 Git-send-pack internals
 
   2 =======================
 
   7 . Connects to the remote side and invokes git-receive-pack.
 
   9 . Learns what refs the remote has and what commit they point at.
 
  10   Matches them to the refspecs we are pushing.
 
  12 . Checks if there are non-fast-forwards.  Unlike fetch-pack,
 
  13   the repository send-pack runs in is supposed to be a superset
 
  14   of the recipient in fast-forward cases, so there is no need
 
  15   for want/have exchanges, and fast-forward check can be done
 
  16   locally.  Tell the result to the other end.
 
  18 . Calls pack_objects() which generates a packfile and sends it
 
  19   over to the other end.
 
  21 . If the remote side is new enough (v1.1.0 or later), wait for
 
  22   the unpack and hook status from the other end.
 
  24 . Exit with appropriate error codes.
 
  30 This function gets one file descriptor (`fd`) which is either a
 
  31 socket (over the network) or a pipe (local).  What's written to
 
  32 this fd goes to git-receive-pack to be unpacked.
 
  34     send-pack ---> fd ---> receive-pack
 
  36 The function pack_objects creates a pipe and then forks.  The
 
  37 forked child execs pack-objects with --revs to receive revision
 
  38 parameters from its standard input. This process will write the
 
  39 packfile to the other end.
 
  43        pack_objects() ---> fd ---> receive-pack
 
  48 The child dup2's to arrange its standard output to go back to
 
  49 the other end, and read its standard input to come from the
 
  50 pipe.  After that it exec's pack-objects.  On the other hand,
 
  51 the parent process, before starting to feed the child pipeline,
 
  52 closes the reading side of the pipe and fd to receive-pack.
 
  59          pack-objects [0] ---> receive-pack
 
  62 [jc: the pipeline was much more complex and needed documentation before
 
  63  I understood an earlier bug, but now it is trivial and straightforward.]