From: Christopher Tiwald <christiwald@gmail.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, gitster@pobox.com, zbyszek@in.waw.pl,
Matthieu.Moy@grenoble-inp.fr, drizzd@aon.at
Subject: Re: [PATCH v3] push: Provide situational hints for non-fast-forward errors
Date: Mon, 26 Mar 2012 15:20:01 -0400 [thread overview]
Message-ID: <20120326192001.GB32387@gmail.com> (raw)
In-Reply-To: <20120323214114.GB18198@sigill.intra.peff.net>
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
next prev parent reply other threads:[~2012-03-26 19:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-20 4:31 [PATCH v3] push: Provide situational hints for non-fast-forward errors Christopher Tiwald
2012-03-20 5:47 ` Junio C Hamano
2012-03-23 21:41 ` Jeff King
2012-03-26 19:20 ` Christopher Tiwald [this message]
2012-03-26 19:51 ` Jeff King
2012-03-26 19:57 ` Christopher Tiwald
2012-03-26 20:00 ` Jeff King
2012-03-26 20:05 ` Junio C Hamano
2012-03-26 20:11 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120326192001.GB32387@gmail.com \
--to=christiwald@gmail.com \
--cc=Matthieu.Moy@grenoble-inp.fr \
--cc=drizzd@aon.at \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=zbyszek@in.waw.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).