HomePhorge

Make the "git upload-pack" proxy more robust

Description

Make the "git upload-pack" proxy more robust

Summary:
Depends on D20381. Ref T8093. This makes minor improvements to the protocol proxy to handle cases where we add, remove, or replace refs and may need to move the "capabilities" section.

Rather than invoking a callback on every ref: parse the whole ref list into a data structure, mutate it if necessary (in a future diff), then dump it back into wire format.

This allows us to shift the capabilities data (which needs to be coupled with the first ref) around if we modify the first ref, and reorder the reflist alphabetically like git does.

When the server has no refs, Git sends no capabilities data. This is easy to emulate, just surprising.

Test Plan:
Tested the cases not covered by D20381:

  • Fetching where the fetch actually fetches data.
  • ls-remote when we hide the first ref (capabilities data properly moves to the first visible ref).
  • ls-remote when the remote is empty (we just drop the capabilities frame completely).

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T8093

Differential Revision: https://secure.phabricator.com/D20436

Details

Provenance
epriestleyAuthored on Apr 16 2019, 9:08 AM
themackabuPushed on Mar 25 2025, 8:07 PM
Parents
rPe08ba99dd3db: Proxy the "git upload-pack" wire protocol
Branches
Unknown
Tags
Unknown

Event Timeline