From: Brandon Williams <bmwill@google.com>
To: git@vger.kernel.org
Cc: sbeller@google.com, Brandon Williams <bmwill@google.com>
Subject: [PATCH 1/3] transport: refactor flag #defines to be more readable
Date: Mon, 19 Dec 2016 10:25:31 -0800 [thread overview]
Message-ID: <1482171933-180601-2-git-send-email-bmwill@google.com> (raw)
In-Reply-To: <1482171933-180601-1-git-send-email-bmwill@google.com>
All of the #defines for the TRANSPORT_* flags are hardcoded to be powers
of two. This can be error prone when adding a new flag and is difficult
to read. This patch refactors these defines to instead use a shift
operation to generate the flags. This makes adding an additional flag
simpilar and makes the defines easier to read.
Signed-off-by: Brandon Williams <bmwill@google.com>
---
transport.h | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/transport.h b/transport.h
index b8e4ee8..1b65458 100644
--- a/transport.h
+++ b/transport.h
@@ -131,21 +131,21 @@ struct transport {
enum transport_family family;
};
-#define TRANSPORT_PUSH_ALL 1
-#define TRANSPORT_PUSH_FORCE 2
-#define TRANSPORT_PUSH_DRY_RUN 4
-#define TRANSPORT_PUSH_MIRROR 8
-#define TRANSPORT_PUSH_PORCELAIN 16
-#define TRANSPORT_PUSH_SET_UPSTREAM 32
-#define TRANSPORT_RECURSE_SUBMODULES_CHECK 64
-#define TRANSPORT_PUSH_PRUNE 128
-#define TRANSPORT_RECURSE_SUBMODULES_ON_DEMAND 256
-#define TRANSPORT_PUSH_NO_HOOK 512
-#define TRANSPORT_PUSH_FOLLOW_TAGS 1024
-#define TRANSPORT_PUSH_CERT_ALWAYS 2048
-#define TRANSPORT_PUSH_CERT_IF_ASKED 4096
-#define TRANSPORT_PUSH_ATOMIC 8192
-#define TRANSPORT_PUSH_OPTIONS 16384
+#define TRANSPORT_PUSH_ALL (1<<0)
+#define TRANSPORT_PUSH_FORCE (1<<1)
+#define TRANSPORT_PUSH_DRY_RUN (1<<2)
+#define TRANSPORT_PUSH_MIRROR (1<<3)
+#define TRANSPORT_PUSH_PORCELAIN (1<<4)
+#define TRANSPORT_PUSH_SET_UPSTREAM (1<<5)
+#define TRANSPORT_RECURSE_SUBMODULES_CHECK (1<<6)
+#define TRANSPORT_PUSH_PRUNE (1<<7)
+#define TRANSPORT_RECURSE_SUBMODULES_ON_DEMAND (1<<8)
+#define TRANSPORT_PUSH_NO_HOOK (1<<9)
+#define TRANSPORT_PUSH_FOLLOW_TAGS (1<<10)
+#define TRANSPORT_PUSH_CERT_ALWAYS (1<<11)
+#define TRANSPORT_PUSH_CERT_IF_ASKED (1<<12)
+#define TRANSPORT_PUSH_ATOMIC (1<<13)
+#define TRANSPORT_PUSH_OPTIONS (1<<14)
extern int transport_summary_width(const struct ref *refs);
--
2.8.0.rc3.226.g39d4020
next prev parent reply other threads:[~2016-12-19 18:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-19 18:25 [PATCH 0/3] push only submodules Brandon Williams
2016-12-19 18:25 ` Brandon Williams [this message]
2016-12-19 18:25 ` [PATCH 2/3] submodules: add RECURSE_SUBMODULES_ONLY value Brandon Williams
2016-12-19 18:25 ` [PATCH 3/3] push: add option to push only submodules Brandon Williams
2016-12-19 18:56 ` Stefan Beller
2016-12-19 18:41 ` [PATCH 0/3] " Junio C Hamano
2016-12-20 19:25 ` Junio C Hamano
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=1482171933-180601-2-git-send-email-bmwill@google.com \
--to=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=sbeller@google.com \
/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).