Re: [PATCH v2 1/3] push: further clean up fields of "struct ref"
From: Jeff King <hidden>
Date: 2016-06-15 22:55:51
On Mon, Jan 21, 2013 at 10:30:28PM -0800, Junio C Hamano wrote:
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.
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 <redacted> --- * 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