Re: [WIP 08/15] connect: discover protocol version outside of get_remote_heads
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 7, 2017, 19:30 UTC
- Message-ID
- <xmqqy3mecp4x.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20171207190446.GB152943@google.com>
Brandon Williams <bmwill@google.com> writes:
> While we could wrap the preamble into a function it sort of defeats the > purpose since you want to be able to call different functions based on > the protocol version you're speaking. That way you can have hard > separations between the code paths which operate on v0/v1 and v2.
As I envision that the need for different processing across protocol versions in real code would become far greater than it would fit in cases within a single switch() statement, I imagined that the reader structure would have a field that says which version of the protocol it is, so that the caller of the preamble thing can inspect it later to switch on it.