Re: [PATCH v3] push: Provide situational hints for non-fast-forward errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 23, 2012 at 05:41:14PM -0400, Jeff King wrote:
> The only time we use the enum values is via the "int nonfastforward"
> passed to transport_push.  I think it would be a lot clearer to leave
> nonfastforward as a single bit in the ref, and then define the enum
> elsewhere (or even just use #define if we are not going to use the enum
> type).

I used the REF_STATUS_* enum as a template for what I wanted to accomplish
when authoring v1, but did notice there was no other place my new
options made much sense (Junio helped me remove one other call between v1
and v2). I like the readability fixup, but it won't compile as both push.c
and transport.c need to see these. Would something like the following
work? It simply moves the define statements to cache.h, so that both push and
transport can use them.

diff --git a/cache.h b/cache.h
index 427b600..cb960c6 100644
--- a/cache.h
+++ b/cache.h
@@ -1009,6 +1009,7 @@ struct ref {
 	char *symref;
 	unsigned int force:1,
 		merge:1,
+		nonfastforward:1,
 		deletion:1;
 	enum {
 		REF_STATUS_NONE = 0,
@@ -1019,15 +1020,14 @@ struct ref {
 		REF_STATUS_REMOTE_REJECT,
 		REF_STATUS_EXPECTING_REPORT
 	} status;
-	enum {
-		NON_FF_HEAD = 1,
-		NON_FF_OTHER
-	} nonfastforward;
 	char *remote_status;
 	struct ref *peer_ref; /* when renaming */
 	char name[FLEX_ARRAY]; /* more */
 };
 
+#define NON_FF_HEAD  1
+#define NON_FF_OTHER 2
+
 #define REF_NORMAL	(1u << 0)
 #define REF_HEADS	(1u << 1)
 #define REF_TAGS	(1u << 2)


It tests fine locally for me using the same test cases I've been using
all along.

--
Christopher Tiwald
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]