Re: [PATCH v2 1/3] push: further clean up fields of "struct ref"
- From
Jeff King <peff@peff.net>
- Date
- Jan 23, 2013, 06:43 UTC
- Message-ID
- <20130123064357.GA10306@sigill.intra.peff.net>
- In-Reply-To
- <1358836230-9197-2-git-send-email-gitster@pobox.com>
On Mon, Jan 21, 2013 at 10:30:28PM -0800, Junio C Hamano wrote:
Show 8 quoted lines
> The "nonfastforward" and "update" fields are only used while > deciding what value to assign to the "status" locally in a single > function. Remove them from the "struct ref". > > The "requires_force" field is not used to decide if the proposed > update requires a --force option to succeed, or to record such a > decision made elsewhere. It is used by status reporting code that > the particular update was "forced". Rename it to "forced_udpate",
Typo.
Show 12 quoted lines
> and move the code to assign to it around to further clarify how it > is used and what it is used for. > > Signed-off-by: Junio C Hamano <gitster@pobox.com> > --- > > * The "update" removal in v1 has been moved to this. > > cache.h | 4 +--- > remote.c | 16 ++++++---------- > transport.c | 2 +- > 3 files changed, 8 insertions(+), 14 deletions(-)
Looks much better.
I wondered briefly why nonfastforward was even there, as I recall that I was the one who added it many years ago. It turns out that it used to serve the purpose of the new forced_update, but Chris's series from a few months ago split it out to "nonfastforward" and "not_forwardable", and then added "requires_force" to give a single flag that is set in either case.
So I think your simplification is correct; the first two can be local variables, and the only thing that matters to carry forward is requires_force (and I agree that forced_update is a better name).
-Peff