From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH v3 1/2] object.h: centralize object flag allocation
Date: Thu, 20 Mar 2014 12:44:13 +0700 [thread overview]
Message-ID: <1395294254-941-1-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1395060676-23144-1-git-send-email-pclouds@gmail.com>
While the field "flags" is mainly used by the revision walker, it is
also used in many other places. Centralize the whole flag allocation to
one place for a better overview (and easier to move flags if we have
too).
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
The next step could be define (instead of document) all of them in
a single place. But that may result in naming conflicts and stuff
for little gain.
bisect.c | 3 +--
builtin/blame.c | 2 +-
bundle.c | 1 +
commit.c | 2 +-
fetch-pack.c | 1 +
http-push.c | 3 +--
object.h | 13 +++++++++++++
revision.h | 1 +
sha1_name.c | 2 ++
upload-pack.c | 2 +-
walker.c | 1 +
11 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/bisect.c b/bisect.c
index 8448d27..d6e851d 100644
--- a/bisect.c
+++ b/bisect.c
@@ -21,8 +21,7 @@ static const char *argv_checkout[] = {"checkout", "-q", NULL, "--", NULL};
static const char *argv_show_branch[] = {"show-branch", NULL, NULL};
static const char *argv_update_ref[] = {"update-ref", "--no-deref", "BISECT_HEAD", NULL, NULL};
-/* bits #0-15 in revision.h */
-
+/* Remember to update object flag allocation in object.h */
#define COUNTED (1u<<16)
/*
diff --git a/builtin/blame.c b/builtin/blame.c
index e5b5d71..88cb799 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -74,7 +74,7 @@ static unsigned blame_copy_score;
#define BLAME_DEFAULT_MOVE_SCORE 20
#define BLAME_DEFAULT_COPY_SCORE 40
-/* bits #0..7 in revision.h, #8..11 used for merge_bases() in commit.c */
+/* Remember to update object flag allocation in object.h */
#define METAINFO_SHOWN (1u<<12)
#define MORE_THAN_ONE_PATH (1u<<13)
diff --git a/bundle.c b/bundle.c
index a85e0e4..1222952 100644
--- a/bundle.c
+++ b/bundle.c
@@ -120,6 +120,7 @@ static int list_refs(struct ref_list *r, int argc, const char **argv)
return 0;
}
+/* Remember to update object flag allocation in object.h */
#define PREREQ_MARK (1u<<16)
int verify_bundle(struct bundle_header *header, int verbose)
diff --git a/commit.c b/commit.c
index 0f28902..f479331 100644
--- a/commit.c
+++ b/commit.c
@@ -721,7 +721,7 @@ void sort_in_topological_order(struct commit_list **list, enum rev_sort_order so
/* merge-base stuff */
-/* bits #0..15 in revision.h */
+/* Remember to update object flag allocation in object.h */
#define PARENT1 (1u<<16)
#define PARENT2 (1u<<17)
#define STALE (1u<<18)
diff --git a/fetch-pack.c b/fetch-pack.c
index f061f1f..fd470e7 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -26,6 +26,7 @@ static int agent_supported;
static struct lock_file shallow_lock;
static const char *alternate_shallow_file;
+/* Remember to update object flag allocation in object.h */
#define COMPLETE (1U << 0)
#define COMMON (1U << 1)
#define COMMON_REF (1U << 2)
diff --git a/http-push.c b/http-push.c
index d4b40c9..f2c56c8 100644
--- a/http-push.c
+++ b/http-push.c
@@ -64,8 +64,7 @@ enum XML_Status {
#define LOCK_TIME 600
#define LOCK_REFRESH 30
-/* bits #0-15 in revision.h */
-
+/* Remember to update object flag allocation in object.h */
#define LOCAL (1u<<16)
#define REMOTE (1u<<17)
#define FETCHING (1u<<18)
diff --git a/object.h b/object.h
index 732bf4d..768490b 100644
--- a/object.h
+++ b/object.h
@@ -26,6 +26,19 @@ struct object_array {
#define OBJECT_ARRAY_INIT { 0, 0, NULL }
#define TYPE_BITS 3
+/*
+ * object flag allocation:
+ * revision.h: 0------10
+ * fetch-pack.c: 0---4
+ * walker.c: 0-2
+ * upload-pack.c: 11---------19
+ * builtin/blame.c: 12-13
+ * bisect.c: 16
+ * bundle.c: 16
+ * http-push.c: 16-19
+ * commit.c: 16-19
+ * sha1_name.c: 20
+ */
#define FLAG_BITS 27
/*
diff --git a/revision.h b/revision.h
index 1eb94c1..0262bbd 100644
--- a/revision.h
+++ b/revision.h
@@ -7,6 +7,7 @@
#include "commit.h"
#include "diff.h"
+/* Remember to update object flag allocation in object.h */
#define SEEN (1u<<0)
#define UNINTERESTING (1u<<1)
#define TREESAME (1u<<2)
diff --git a/sha1_name.c b/sha1_name.c
index 6fca869..2b6322f 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -819,6 +819,8 @@ static int get_sha1_1(const char *name, int len, unsigned char *sha1, unsigned l
* For future extension, ':/!' is reserved. If you want to match a message
* beginning with a '!', you have to repeat the exclamation mark.
*/
+
+/* Remember to update object flag allocation in object.h */
#define ONELINE_SEEN (1u<<20)
static int handle_one_ref(const char *path,
diff --git a/upload-pack.c b/upload-pack.c
index 9314c25..27df12f 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -17,7 +17,7 @@
static const char upload_pack_usage[] = "git upload-pack [--strict] [--timeout=<n>] <dir>";
-/* bits #0..7 in revision.h, #8..10 in commit.c */
+/* Remember to update object flag allocation in object.h */
#define THEY_HAVE (1u << 11)
#define OUR_REF (1u << 12)
#define WANTED (1u << 13)
diff --git a/walker.c b/walker.c
index 633596e..1dd86b8 100644
--- a/walker.c
+++ b/walker.c
@@ -60,6 +60,7 @@ static int process_tree(struct walker *walker, struct tree *tree)
return 0;
}
+/* Remember to update object flag allocation in object.h */
#define COMPLETE (1U << 0)
#define SEEN (1U << 1)
#define TO_SCAN (1U << 2)
--
1.9.0.201.g13d9d8b
next prev parent reply other threads:[~2014-03-20 5:44 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-06 14:02 Confusing git log --- First time bug submission please advise on best practices Francis Stephens
2014-02-06 16:08 ` Vincent van Ravesteijn
2014-02-06 16:10 ` David Kastrup
2014-02-07 9:43 ` Francis Stephens
2014-02-07 10:26 ` Duy Nguyen
2014-02-07 11:37 ` demerphq
2014-02-08 13:50 ` [PATCH] log: add --show-linear-break to help see non-linear history Nguyễn Thái Ngọc Duy
2014-03-17 12:51 ` [PATCH v2] log: add --nonlinear-barrier " Nguyễn Thái Ngọc Duy
2014-03-17 19:09 ` Eric Sunshine
2014-03-17 20:32 ` Junio C Hamano
2014-03-18 11:46 ` Duy Nguyen
2014-03-18 19:08 ` Junio C Hamano
2014-03-20 5:44 ` Nguyễn Thái Ngọc Duy [this message]
2014-03-20 5:44 ` [PATCH v3 2/2] log: add --show-linear-break " Nguyễn Thái Ngọc Duy
2014-03-20 19:15 ` Junio C Hamano
2014-03-21 1:02 ` Duy Nguyen
2014-03-25 13:23 ` [PATCH v4 1/2] object.h: centralize object flag allocation Nguyễn Thái Ngọc Duy
2014-03-25 13:23 ` [PATCH v4 2/2] log: add --show-linear-break to help see non-linear history Nguyễn Thái Ngọc Duy
2014-03-25 22:30 ` 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=1395294254-941-1-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).