clean up struct ref's nonfastforward field

Each ref structure contains a "nonfastforward" field which is set during push to show whether the ref rewound history. Originally this was a single bit, but it was changed in f25950f (push: Provide situational hints for non-fast-forward errors) to an enum differentiating a non-ff of the current branch versus another branch. However, we never actually set the member according to the enum values, nor did we ever read it expecting anything but a boolean value. But we did use the side effect of declaring the enum constants to store those values in a totally different integer variable. The code as-is isn't buggy, but the enum declaration inside "struct ref" is somewhat misleading. Let's convert nonfastforward back into a single bit, and then define the NON_FF_* constants closer to where they would be used (they are returned via the "int *nonfastforward" parameter to transport_push, so we can define them there). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Mar 26, 2012 at 15:51 UTC e339aa92ae2db194a3d5738cb3aee6d8b3bf7b10
2 files changed +3 -4
cache.h
+1 -4
@@ -1009,6 +1009,7 @@ struct ref {
1009 char *symref;
1010 unsigned int force:1,
1011 merge:1,
1012 + nonfastforward:1,
1013 deletion:1;
1014 enum {
1015 REF_STATUS_NONE = 0,
@@ -1019,10 +1020,6 @@ struct ref {
1020 REF_STATUS_REMOTE_REJECT,
1021 REF_STATUS_EXPECTING_REPORT
1022 } status;
1022 - enum {
1023 - NON_FF_HEAD = 1,
1024 - NON_FF_OTHER
1025 - } nonfastforward;
1023 char *remote_status;
1024 struct ref *peer_ref; /* when renaming */
1025 char name[FLEX_ARRAY]; /* more */
transport.h
+2
@@ -138,6 +138,8 @@ int transport_set_option(struct transport *transport, const char *name,
138 void transport_set_verbosity(struct transport *transport, int verbosity,
139 int force_progress);
140
141 +#define NON_FF_HEAD 1
142 +#define NON_FF_OTHER 2
143 int transport_push(struct transport *connection,
144 int refspec_nr, const char **refspec, int flags,
145 int * nonfastforward);