object.h: centralize object flag allocation
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Tue, 25 Mar 2014 13:23:26 +0000 (20:23 +0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 25 Mar 2014 22:09:24 +0000 (15:09 -0700)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bisect.c
builtin/blame.c
bundle.c
commit.c
fetch-pack.c
http-push.c
object.h
revision.h
sha1_name.c
upload-pack.c
walker.c
index 37200b41f1dce3359c491039aeebea0108597833..48ccbf118f3bc2e2df837f8579717546a617064e 100644 (file)
--- 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)
 
 /*
index e44a6bb30a5a5299c6d57150dd2f23454b25891a..599fb580652039e7bc9cdedf193d58bfb4b3baaf 100644 (file)
@@ -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)
 
index e99065ce425ad6e816d946626ef83075ab70bf85..85d4a6abe156621007bed50e894442fdfdf0ee19 100644 (file)
--- a/bundle.c
+++ b/bundle.c
@@ -124,6 +124,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)
index 6bf4fe00d4b0365eca75fd9988852650660b6884..96278c2fa509a154ec1216750809261af3690296 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -731,7 +731,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)
index d52de74c4b1f1a4cfcda756918d310e475c4c12c..a7388bee9ff06db90a73ea601dfefcd13dc58020 100644 (file)
@@ -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)
index d4b40c9c60e8caa2b8f8e676ac18b678b6ca2ed6..f2c56c84544be36414686ed2e27c8b08e8946e53 100644 (file)
@@ -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)
index dc5df8ce1d9579a28477f91300aa7a49f37ad4e4..5e3006603c54d0470c5562b44ac7ad51b66d5a76 100644 (file)
--- 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
 
 /*
index 88967d6a24df852453f93cb7bc466386347b0c45..531fb0de4278113c1fcdc9a3781a16d294d2bcc9 100644 (file)
@@ -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)
index a5578f718ea092338eb16fbe7dbf867a98e82218..23bb821d25fb8055ea9b7687305a790339908171 100644 (file)
@@ -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,
index 0c44f6b292563e7c87bce0b7b5d9b8a4ccd32ec3..96013b35eca329ab134dc869ecf3824eea9e76e0 100644 (file)
@@ -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)
index 633596e06fcaa1154980f95c858c61379c968d49..1dd86b8f33e04cfc6c0616578416acb1160b5718 100644 (file)
--- 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)