code: func (s *session) UploadPack(ctx context.Context, req *packp.UploadPackRequest) (*packp.UploadPackResponse, error) {
  	if req.IsEmpty() {
  		return nil, transport.ErrEmptyUploadPackRequest
  	}
  
  	if err := req.Validate(); err != nil {
  		return nil, err
  	}
  
  	if _, err := s.AdvertisedReferences(); err != nil {
  		return nil, err
  	}
  
  	s.packRun = true
  
  	in := s.StdinContext(ctx)
  	out := s.StdoutContext(ctx)
  
  	if err := uploadPack(in, out, req); err != nil {
  		return nil, err
  	}
  
  	r, err := ioutil.NonEmptyReader(out)
  	if err == ioutil.ErrEmptyReader {
  		if c, ok := s.Stdout.(io.Closer); ok {
  			_ = c.Close()
  		}
  
  		return nil, transport.ErrEmptyUploadPackRequest
  	}
  
  	if err != nil {
  		return nil, err
  	}
  
  	rc := ioutil.NewReadCloser(r, s)
  	return DecodeUploadPackResponse(rc, req)
  }
docs: // UploadPack performs a request to the server to fetch a packfile. A reader is
  // returned with the packfile content. The reader must be closed after reading.