{"thread":{"id":"13699","subject":"[PATCH] revisions: move traversal bit-fields to masks.","startedAt":"2008-05-28T09:17:24Z","lastAt":"2008-05-28T17:16:25Z","messageCount":3,"participants":["Pierre Habouzit"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"77925","messageId":"1211966245-18393-1-git-send-email-madcoder@debian.org","threadId":"13699","inReplyTo":null,"subject":"[PATCH] revisions: refactor init_revisions and setup_revisions.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2008-05-28T09:17:24Z","receivedAt":"2008-05-28T09:17:24Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"struct rev_info gains two new field:\n* .def to store --default argument;\n* .show_merge 1-bit field.\n\nsetup_revisions has been split in two: parse_revisions that does (almost)\nonly argument parsing, to be more like what parse-options can do, and\nsetup_revisions that does the rest.\n\nMany places had no arguments to pass to setup_revisions, and those don't use\nparse_revisions at all.\n\nSigned-off-by: Pierre Habouzit <madcoder@debian.org>\n---\n\n  This patch was submitted long time ago, Junio did some remarks I've now\n  integrated (wrt the default argument that I passed to init_revisions once,\n  and now is back as a setup_revisions argument).\n\n builtin-add.c           |    2 +-\n builtin-blame.c         |    3 ++-\n builtin-checkout.c      |    3 ++-\n builtin-commit.c        |    4 ++--\n builtin-diff-files.c    |    3 ++-\n builtin-diff-index.c    |    3 ++-\n builtin-diff-tree.c     |    3 ++-\n builtin-diff.c          |    3 ++-\n builtin-fast-export.c   |    3 ++-\n builtin-fmt-merge-msg.c |    2 +-\n builtin-log.c           |    7 ++++---\n builtin-pack-objects.c  |    3 ++-\n builtin-rev-list.c      |    3 ++-\n builtin-revert.c        |    2 +-\n builtin-shortlog.c      |    3 ++-\n bundle.c                |    6 ++++--\n http-push.c             |    3 ++-\n revision.c              |   32 ++++++++++++++++++--------------\n revision.h              |    7 +++++--\n upload-pack.c           |    4 ++--\n wt-status.c             |    6 +++---\n 21 files changed, 63 insertions(+), 42 deletions(-)\n\ndiff --git a/builtin-add.c b/builtin-add.c\nindex 1da22ee..c60d310 100644\n--- a/builtin-add.c\n+++ b/builtin-add.c\n@@ -121,7 +121,7 @@ int add_files_to_cache(const char *prefix, const char **pathspec, int flags)\n \tstruct update_callback_data data;\n \tstruct rev_info rev;\n \tinit_revisions(&rev, prefix);\n-\tsetup_revisions(0, NULL, &rev, NULL);\n+\tsetup_revisions(&rev, NULL);\n \trev.prune_data = pathspec;\n \trev.diffopt.output_format = DIFF_FORMAT_CALLBACK;\n \trev.diffopt.format_callback = update_callback;\ndiff --git a/builtin-blame.c b/builtin-blame.c\nindex cf41511..1e26b88 100644\n--- a/builtin-blame.c\n+++ b/builtin-blame.c\n@@ -2425,7 +2425,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)\n \targv[unk] = NULL;\n \n \tinit_revisions(&revs, NULL);\n-\tsetup_revisions(unk, argv, &revs, NULL);\n+\tparse_revisions(unk, argv, &revs);\n+\tsetup_revisions(&revs, NULL);\n \tmemset(&sb, 0, sizeof(sb));\n \n \tsb.revs = &revs;\ndiff --git a/builtin-checkout.c b/builtin-checkout.c\nindex 1ea017f..9d83fdb 100644\n--- a/builtin-checkout.c\n+++ b/builtin-checkout.c\n@@ -357,7 +357,8 @@ static void report_tracking(struct branch_info *new, struct checkout_opts *opts)\n \tstrcpy(symmetric + 43, sha1_to_hex(theirs->object.sha1));\n \n \tinit_revisions(&revs, NULL);\n-\tsetup_revisions(rev_argc, rev_argv, &revs, NULL);\n+\tparse_revisions(rev_argc, rev_argv, &revs);\n+\tsetup_revisions(&revs, NULL);\n \tprepare_revision_walk(&revs);\n \n \t/* ... and count the commits on each side. */\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex 07872c8..59b3dc2 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -600,7 +600,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix)\n \t\telse {\n \t\t\tinit_revisions(&rev, \"\");\n \t\t\trev.abbrev = 0;\n-\t\t\tsetup_revisions(0, NULL, &rev, parent);\n+\t\t\tsetup_revisions(&rev, parent);\n \t\t\tDIFF_OPT_SET(&rev.diffopt, QUIET);\n \t\t\tDIFF_OPT_SET(&rev.diffopt, EXIT_WITH_STATUS);\n \t\t\trun_diff_index(&rev, 1 /* cached */);\n@@ -834,7 +834,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n \t\tdie(\"could not parse newly created commit\");\n \n \tinit_revisions(&rev, prefix);\n-\tsetup_revisions(0, NULL, &rev, NULL);\n+\tsetup_revisions(&rev, NULL);\n \n \trev.abbrev = 0;\n \trev.diff = 1;\ndiff --git a/builtin-diff-files.c b/builtin-diff-files.c\nindex 384d871..e7e202a 100644\n--- a/builtin-diff-files.c\n+++ b/builtin-diff-files.c\n@@ -23,7 +23,8 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)\n \tgit_config(git_diff_basic_config, NULL); /* no \"diff\" UI options */\n \trev.abbrev = 0;\n \n-\targc = setup_revisions(argc, argv, &rev, NULL);\n+\targc = parse_revisions(argc, argv, &rev);\n+\tsetup_revisions(&rev, NULL);\n \twhile (1 < argc && argv[1][0] == '-') {\n \t\tif (!strcmp(argv[1], \"--base\"))\n \t\t\trev.max_count = 1;\ndiff --git a/builtin-diff-index.c b/builtin-diff-index.c\nindex 2f44ebf..286a9de 100644\n--- a/builtin-diff-index.c\n+++ b/builtin-diff-index.c\n@@ -20,7 +20,8 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)\n \tgit_config(git_diff_basic_config, NULL); /* no \"diff\" UI options */\n \trev.abbrev = 0;\n \n-\targc = setup_revisions(argc, argv, &rev, NULL);\n+\targc = parse_revisions(argc, argv, &rev);\n+\tsetup_revisions(&rev, NULL);\n \tfor (i = 1; i < argc; i++) {\n \t\tconst char *arg = argv[i];\n \ndiff --git a/builtin-diff-tree.c b/builtin-diff-tree.c\nindex 9d2a48f..0900175 100644\n--- a/builtin-diff-tree.c\n+++ b/builtin-diff-tree.c\n@@ -72,7 +72,8 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)\n \tnr_sha1 = 0;\n \topt->abbrev = 0;\n \topt->diff = 1;\n-\targc = setup_revisions(argc, argv, opt, NULL);\n+\targc = parse_revisions(argc, argv, opt);\n+\tsetup_revisions(opt, NULL);\n \n \twhile (--argc > 0) {\n \t\tconst char *arg = *++argv;\ndiff --git a/builtin-diff.c b/builtin-diff.c\nindex 4c289e7..a92dbd4 100644\n--- a/builtin-diff.c\n+++ b/builtin-diff.c\n@@ -283,7 +283,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix)\n \n \tif (nongit)\n \t\tdie(\"Not a git repository\");\n-\targc = setup_revisions(argc, argv, &rev, NULL);\n+\targc = parse_revisions(argc, argv, &rev);\n+\tsetup_revisions(&rev, NULL);\n \tif (!rev.diffopt.output_format) {\n \t\trev.diffopt.output_format = DIFF_FORMAT_PATCH;\n \t\tif (diff_setup_done(&rev.diffopt) < 0)\ndiff --git a/builtin-fast-export.c b/builtin-fast-export.c\nindex 1dfc01e..59b60b5 100755\n--- a/builtin-fast-export.c\n+++ b/builtin-fast-export.c\n@@ -371,7 +371,8 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)\n \tgit_config(git_default_config, NULL);\n \n \tinit_revisions(&revs, prefix);\n-\targc = setup_revisions(argc, argv, &revs, NULL);\n+\targc = parse_revisions(argc, argv, &revs);\n+\tsetup_revisions(&revs, NULL);\n \targc = parse_options(argc, argv, options, fast_export_usage, 0);\n \tif (argc > 1)\n \t\tusage_with_options (fast_export_usage, options);\ndiff --git a/builtin-fmt-merge-msg.c b/builtin-fmt-merge-msg.c\nindex b892621..dad81b8 100644\n--- a/builtin-fmt-merge-msg.c\n+++ b/builtin-fmt-merge-msg.c\n@@ -187,7 +187,7 @@ static void shortlog(const char *name, unsigned char *sha1,\n \tif (!branch || branch->type != OBJ_COMMIT)\n \t\treturn;\n \n-\tsetup_revisions(0, NULL, rev, NULL);\n+\tsetup_revisions(rev, NULL);\n \trev->ignore_merges = 1;\n \tadd_pending_object(rev, branch, name);\n \tadd_pending_object(rev, &head->object, \"^HEAD\");\ndiff --git a/builtin-log.c b/builtin-log.c\nindex 9817d6f..dde7192 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -68,8 +68,8 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,\n \tif (default_date_mode)\n \t\trev->date_mode = parse_date_format(default_date_mode);\n \n-\targc = setup_revisions(argc, argv, rev, \"HEAD\");\n-\n+\targc = parse_revisions(argc, argv, rev);\n+\tsetup_revisions(rev, \"HEAD\");\n \tif (rev->diffopt.pickaxe || rev->diffopt.filter)\n \t\trev->always_show_header = 0;\n \tif (DIFF_OPT_TST(&rev->diffopt, FOLLOW_RENAMES)) {\n@@ -927,7 +927,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \tif (numbered_files && use_stdout)\n \t\tdie (\"--numbered-files and --stdout are mutually exclusive.\");\n \n-\targc = setup_revisions(argc, argv, &rev, \"HEAD\");\n+\targc = parse_revisions(argc, argv, &rev);\n+\tsetup_revisions(&rev, \"HEAD\");\n \tif (argc > 1)\n \t\tdie (\"unrecognized argument: %s\", argv[1]);\n \ndiff --git a/builtin-pack-objects.c b/builtin-pack-objects.c\nindex 70d2f5d..46a8abc 100644\n--- a/builtin-pack-objects.c\n+++ b/builtin-pack-objects.c\n@@ -1981,7 +1981,8 @@ static void get_object_list(int ac, const char **av)\n \n \tinit_revisions(&revs, NULL);\n \tsave_commit_buffer = 0;\n-\tsetup_revisions(ac, av, &revs, NULL);\n+\tparse_revisions(ac, av, &revs);\n+\tsetup_revisions(&revs, NULL);\n \n \twhile (fgets(line, sizeof(line), stdin) != NULL) {\n \t\tint len = strlen(line);\ndiff --git a/builtin-rev-list.c b/builtin-rev-list.c\nindex 11a7eae..ed60227 100644\n--- a/builtin-rev-list.c\n+++ b/builtin-rev-list.c\n@@ -605,7 +605,8 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n \tinit_revisions(&revs, prefix);\n \trevs.abbrev = 0;\n \trevs.commit_format = CMIT_FMT_UNSPECIFIED;\n-\targc = setup_revisions(argc, argv, &revs, NULL);\n+\targc = parse_revisions(argc, argv, &revs);\n+\tsetup_revisions(&revs, NULL);\n \n \tfor (i = 1 ; i < argc; i++) {\n \t\tconst char *arg = argv[i];\ndiff --git a/builtin-revert.c b/builtin-revert.c\nindex 0270f9b..0adff14 100644\n--- a/builtin-revert.c\n+++ b/builtin-revert.c\n@@ -253,7 +253,7 @@ static int index_is_dirty(void)\n {\n \tstruct rev_info rev;\n \tinit_revisions(&rev, NULL);\n-\tsetup_revisions(0, NULL, &rev, \"HEAD\");\n+\tsetup_revisions(&rev, \"HEAD\");\n \tDIFF_OPT_SET(&rev.diffopt, QUIET);\n \tDIFF_OPT_SET(&rev.diffopt, EXIT_WITH_STATUS);\n \trun_diff_index(&rev, 1);\ndiff --git a/builtin-shortlog.c b/builtin-shortlog.c\nindex e6a2865..3428bf6 100644\n--- a/builtin-shortlog.c\n+++ b/builtin-shortlog.c\n@@ -256,7 +256,8 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix)\n \t\targc--;\n \t}\n \tinit_revisions(&rev, prefix);\n-\targc = setup_revisions(argc, argv, &rev, NULL);\n+\targc = parse_revisions(argc, argv, &rev);\n+\tsetup_revisions(&rev, NULL);\n \tif (argc > 1)\n \t\tdie (\"unrecognized argument: %s\", argv[1]);\n \ndiff --git a/bundle.c b/bundle.c\nindex 0ba5df1..c4848d7 100644\n--- a/bundle.c\n+++ b/bundle.c\n@@ -120,7 +120,8 @@ int verify_bundle(struct bundle_header *header, int verbose)\n \tif (revs.pending.nr != p->nr)\n \t\treturn ret;\n \treq_nr = revs.pending.nr;\n-\tsetup_revisions(2, argv, &revs, NULL);\n+\tparse_revisions(2, argv, &revs);\n+\tsetup_revisions(&revs, NULL);\n \n \tmemset(&refs, 0, sizeof(struct object_array));\n \tfor (i = 0; i < revs.pending.nr; i++) {\n@@ -226,7 +227,8 @@ int create_bundle(struct bundle_header *header, const char *path,\n \t\treturn error(\"rev-list died\");\n \n \t/* write references */\n-\targc = setup_revisions(argc, argv, &revs, NULL);\n+\targc = parse_revisions(argc, argv, &revs);\n+\tsetup_revisions(&revs, NULL);\n \tif (argc > 1)\n \t\treturn error(\"unrecognized argument: %s'\", argv[1]);\n \ndiff --git a/http-push.c b/http-push.c\nindex f173dcd..fa757ff 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -2406,7 +2406,8 @@ int main(int argc, char **argv)\n \t\t\tcommit_argc++;\n \t\t}\n \t\tinit_revisions(&revs, setup_git_directory());\n-\t\tsetup_revisions(commit_argc, commit_argv, &revs, NULL);\n+\t\tparse_revisions(commit_argc, commit_argv, &revs);\n+\t\tsetup_revisions(&revs, NULL);\n \t\tfree(new_sha1_hex);\n \t\tif (old_sha1_hex) {\n \t\t\tfree(old_sha1_hex);\ndiff --git a/revision.c b/revision.c\nindex 5a1a948..4abe410 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -964,9 +964,9 @@ static void add_ignore_packed(struct rev_info *revs, const char *name)\n  * Returns the number of arguments left that weren't recognized\n  * (which are also moved to the head of the argument list)\n  */\n-int setup_revisions(int argc, const char **argv, struct rev_info *revs, const char *def)\n+int parse_revisions(int argc, const char **argv, struct rev_info *revs)\n {\n-\tint i, flags, seen_dashdash, show_merge;\n+\tint i, flags, seen_dashdash;\n \tconst char **unrecognized = argv + 1;\n \tint left = 1;\n \tint all_match = 0;\n@@ -987,7 +987,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch\n \t\tbreak;\n \t}\n \n-\tflags = show_merge = 0;\n+\tflags = 0;\n \tfor (i = 1; i < argc; i++) {\n \t\tconst char *arg = argv[i];\n \t\tif (*arg == '-') {\n@@ -1075,11 +1075,11 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch\n \t\t\tif (!strcmp(arg, \"--default\")) {\n \t\t\t\tif (++i >= argc)\n \t\t\t\t\tdie(\"bad --default argument\");\n-\t\t\t\tdef = argv[i];\n+\t\t\t\trevs->def = argv[i];\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--merge\")) {\n-\t\t\t\tshow_merge = 1;\n+\t\t\t\trevs->show_merge = 1;\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--topo-order\")) {\n@@ -1361,18 +1361,25 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch\n \tif (revs->grep_filter) {\n \t\trevs->grep_filter->regflags |= regflags;\n \t\trevs->grep_filter->fixed = fixed;\n+\t\trevs->grep_filter->all_match = all_match;\n \t}\n+\treturn left;\n+}\n \n-\tif (show_merge)\n+void setup_revisions(struct rev_info *revs, const char *def)\n+{\n+\tif (revs->def == NULL)\n+\t\trevs->def = def;\n+\tif (revs->show_merge)\n \t\tprepare_show_merge(revs);\n-\tif (def && !revs->pending.nr) {\n+\tif (revs->def && !revs->pending.nr) {\n \t\tunsigned char sha1[20];\n \t\tstruct object *object;\n \t\tunsigned mode;\n-\t\tif (get_sha1_with_mode(def, sha1, &mode))\n-\t\t\tdie(\"bad default revision '%s'\", def);\n-\t\tobject = get_reference(revs, def, sha1, 0);\n-\t\tadd_pending_object_with_mode(revs, object, def, mode);\n+\t\tif (get_sha1_with_mode(revs->def, sha1, &mode))\n+\t\t\tdie(\"bad default revision '%s'\", revs->def);\n+\t\tobject = get_reference(revs, revs->def, sha1, 0);\n+\t\tadd_pending_object_with_mode(revs, object, revs->def, mode);\n \t}\n \n \t/* Did the user ask for any diff output? Run the diff! */\n@@ -1406,7 +1413,6 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch\n \t\tdie(\"diff_setup_done failed\");\n \n \tif (revs->grep_filter) {\n-\t\trevs->grep_filter->all_match = all_match;\n \t\tcompile_grep_patterns(revs->grep_filter);\n \t}\n \n@@ -1423,8 +1429,6 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch\n \n \tif (revs->reflog_info && revs->graph)\n \t\tdie(\"cannot combine --walk-reflogs with --graph\");\n-\n-\treturn left;\n }\n \n static void add_child(struct rev_info *revs, struct commit *parent, struct commit *child)\ndiff --git a/revision.h b/revision.h\nindex dcf08e0..72ab144 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -25,6 +25,7 @@ struct rev_info {\n \n \t/* Basic information */\n \tconst char *prefix;\n+\tconst char *def;\n \tvoid *prune_data;\n \tunsigned int early_output;\n \n@@ -65,8 +66,9 @@ struct rev_info {\n \n \t/* Format info */\n \tunsigned int\tshown_one:1,\n-\t\t\tabbrev_commit:1,\n+\t\t\tshow_merge:1,\n \t\t\tuse_terminator:1,\n+\t\t\tabbrev_commit:1,\n \t\t\tmissing_newline:1;\n \tenum date_mode date_mode;\n \n@@ -116,7 +118,8 @@ typedef void (*show_early_output_fn_t)(struct rev_info *, struct commit_list *);\n volatile show_early_output_fn_t show_early_output;\n \n extern void init_revisions(struct rev_info *revs, const char *prefix);\n-extern int setup_revisions(int argc, const char **argv, struct rev_info *revs, const char *def);\n+extern int parse_revisions(int argc, const char **argv, struct rev_info *revs);\n+extern void setup_revisions(struct rev_info *revs, const char *def);\n extern int handle_revision_arg(const char *arg, struct rev_info *revs,int flags,int cant_be_filename);\n \n extern int prepare_revision_walk(struct rev_info *revs);\ndiff --git a/upload-pack.c b/upload-pack.c\nindex b46dd36..9d031fc 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -116,7 +116,7 @@ static int do_rev_list(int fd, void *create_full_pack)\n \n \tif (create_full_pack) {\n \t\tconst char *args[] = {\"rev-list\", \"--all\", NULL};\n-\t\tsetup_revisions(2, args, &revs, NULL);\n+\t\tparse_revisions(2, args, &revs);\n \t} else {\n \t\tfor (i = 0; i < want_obj.nr; i++) {\n \t\t\tstruct object *o = want_obj.objects[i].item;\n@@ -129,8 +129,8 @@ static int do_rev_list(int fd, void *create_full_pack)\n \t\t\to->flags |= UNINTERESTING;\n \t\t\tadd_pending_object(&revs, o, NULL);\n \t\t}\n-\t\tsetup_revisions(0, NULL, &revs, NULL);\n \t}\n+\tsetup_revisions(&revs, NULL);\n \tif (prepare_revision_walk(&revs))\n \t\tdie(\"revision walk setup failed\");\n \tmark_edges_uninteresting(revs.commits, &revs, show_edge);\ndiff --git a/wt-status.c b/wt-status.c\nindex 5b4d74c..7fa6f59 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -204,7 +204,7 @@ static void wt_status_print_updated(struct wt_status *s)\n {\n \tstruct rev_info rev;\n \tinit_revisions(&rev, NULL);\n-\tsetup_revisions(0, NULL, &rev, s->reference);\n+\tsetup_revisions(&rev, s->reference);\n \trev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;\n \trev.diffopt.format_callback = wt_status_print_updated_cb;\n \trev.diffopt.format_callback_data = s;\n@@ -218,7 +218,7 @@ static void wt_status_print_changed(struct wt_status *s)\n {\n \tstruct rev_info rev;\n \tinit_revisions(&rev, \"\");\n-\tsetup_revisions(0, NULL, &rev, NULL);\n+\tsetup_revisions(&rev, NULL);\n \trev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;\n \trev.diffopt.format_callback = wt_status_print_changed_cb;\n \trev.diffopt.format_callback_data = s;\n@@ -306,7 +306,7 @@ static void wt_status_print_verbose(struct wt_status *s)\n \tstruct rev_info rev;\n \n \tinit_revisions(&rev, NULL);\n-\tsetup_revisions(0, NULL, &rev, s->reference);\n+\tsetup_revisions(&rev, s->reference);\n \trev.diffopt.output_format |= DIFF_FORMAT_PATCH;\n \trev.diffopt.detect_rename = 1;\n \trev.diffopt.file = s->fp;\n-- \n1.5.6.rc0.145.ge0aba\n"},{"id":"77924","messageId":"1211966245-18393-2-git-send-email-madcoder@debian.org","threadId":"13699","inReplyTo":"1211966245-18393-1-git-send-email-madcoder@debian.org","subject":"[PATCH] revisions: move traversal bit-fields to masks.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2008-05-28T09:17:25Z","receivedAt":"2008-05-28T09:17:25Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"Signed-off-by: Pierre Habouzit <madcoder@debian.org>\n---\n\n    This work is preliminary to anything you could do to migrate revisions and\n    diff options parsing to parseopt. I use it for many months now.\n\n builtin-commit.c        |    8 +-\n builtin-diff-files.c    |    6 +-\n builtin-diff-tree.c     |    2 +-\n builtin-diff.c          |   14 ++-\n builtin-fmt-merge-msg.c |    6 +-\n builtin-log.c           |   64 ++++++++-------\n builtin-rev-list.c      |   25 +++---\n combine-diff.c          |    8 +-\n diff-lib.c              |   10 +-\n graph.c                 |   10 ++-\n list-objects.c          |    6 +-\n log-tree.c              |   42 +++++-----\n pretty.c                |    6 +-\n reachable.c             |    6 +-\n revision.c              |  202 +++++++++++++++++++++++-----------------------\n revision.h              |   95 +++++++++++++----------\n upload-pack.c           |    8 +-\n 17 files changed, 272 insertions(+), 246 deletions(-)\n\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex 59b3dc2..4fc7eaa 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -837,14 +837,14 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n \tsetup_revisions(&rev, NULL);\n \n \trev.abbrev = 0;\n-\trev.diff = 1;\n+\tREV_DIFF_SET(&rev, DIFF);\n+\tREV_DIFF_SET(&rev, VERBOSE_HEADER);\n+\tREV_DIFF_SET(&rev, SHOW_ROOT_DIFF);\n \trev.diffopt.output_format =\n \t\tDIFF_FORMAT_SHORTSTAT | DIFF_FORMAT_SUMMARY;\n \n-\trev.verbose_header = 1;\n-\trev.show_root_diff = 1;\n \tget_commit_format(\"format:%h: %s\", &rev);\n-\trev.always_show_header = 0;\n+\tREV_DIFF_CLR(&rev, ALWAYS_SHOW_HEADER);\n \trev.diffopt.detect_rename = 1;\n \trev.diffopt.rename_limit = 100;\n \trev.diffopt.break_opt = 0;\ndiff --git a/builtin-diff-files.c b/builtin-diff-files.c\nindex e7e202a..cb7a318 100644\n--- a/builtin-diff-files.c\n+++ b/builtin-diff-files.c\n@@ -52,8 +52,10 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)\n \t\tusage(diff_files_usage);\n \n \tif (rev.max_count == -1 &&\n-\t    (rev.diffopt.output_format & DIFF_FORMAT_PATCH))\n-\t\trev.combine_merges = rev.dense_combined_merges = 1;\n+\t    (rev.diffopt.output_format & DIFF_FORMAT_PATCH)) {\n+\t\tREV_DIFF_SET(&rev, COMBINE_MERGES);\n+\t\tREV_DIFF_SET(&rev, DENSE_COMBINED_MERGES);\n+\t}\n \n \tif (read_cache() < 0) {\n \t\tperror(\"read_cache\");\ndiff --git a/builtin-diff-tree.c b/builtin-diff-tree.c\nindex 0900175..9a34a36 100644\n--- a/builtin-diff-tree.c\n+++ b/builtin-diff-tree.c\n@@ -71,7 +71,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)\n \tgit_config(git_diff_basic_config, NULL); /* no \"diff\" UI options */\n \tnr_sha1 = 0;\n \topt->abbrev = 0;\n-\topt->diff = 1;\n+\tREV_DIFF_SET(opt, DIFF);\n \targc = parse_revisions(argc, argv, opt);\n \tsetup_revisions(opt, NULL);\n \ndiff --git a/builtin-diff.c b/builtin-diff.c\nindex a92dbd4..acf50aa 100644\n--- a/builtin-diff.c\n+++ b/builtin-diff.c\n@@ -170,15 +170,17 @@ static int builtin_diff_combined(struct rev_info *revs,\n \tif (argc > 1)\n \t\tusage(builtin_diff_usage);\n \n-\tif (!revs->dense_combined_merges && !revs->combine_merges)\n-\t\trevs->dense_combined_merges = revs->combine_merges = 1;\n+\tif (!REV_DIFF_TST(revs, DENSE_COMBINED_MERGES) && !REV_DIFF_TST(revs, COMBINE_MERGES)) {\n+\t\tREV_DIFF_SET(revs, DENSE_COMBINED_MERGES);\n+\t\tREV_DIFF_SET(revs, COMBINE_MERGES);\n+\t}\n \tparent = xmalloc(ents * sizeof(*parent));\n \t/* Again, the revs are all reverse */\n \tfor (i = 0; i < ents; i++)\n \t\thashcpy((unsigned char *)(parent + i),\n \t\t\tent[ents - 1 - i].item->sha1);\n \tdiff_tree_combined(parent[0], parent + 1, ents - 1,\n-\t\t\t   revs->dense_combined_merges, revs);\n+\t\t\t   REV_DIFF_TST(revs, DENSE_COMBINED_MERGES), revs);\n \treturn 0;\n }\n \n@@ -222,8 +224,10 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv\n \t}\n \n \tif (revs->max_count == -1 &&\n-\t    (revs->diffopt.output_format & DIFF_FORMAT_PATCH))\n-\t\trevs->combine_merges = revs->dense_combined_merges = 1;\n+\t    (revs->diffopt.output_format & DIFF_FORMAT_PATCH)) {\n+\t\tREV_DIFF_SET(revs, COMBINE_MERGES);\n+\t\tREV_DIFF_SET(revs, DENSE_COMBINED_MERGES);\n+\t}\n \n \tif (read_cache() < 0) {\n \t\tperror(\"read_cache\");\ndiff --git a/builtin-fmt-merge-msg.c b/builtin-fmt-merge-msg.c\nindex dad81b8..29a1cfe 100644\n--- a/builtin-fmt-merge-msg.c\n+++ b/builtin-fmt-merge-msg.c\n@@ -188,7 +188,7 @@ static void shortlog(const char *name, unsigned char *sha1,\n \t\treturn;\n \n \tsetup_revisions(rev, NULL);\n-\trev->ignore_merges = 1;\n+\tREV_DIFF_SET(rev, IGNORE_MERGES);\n \tadd_pending_object(rev, branch, name);\n \tadd_pending_object(rev, &head->object, \"^HEAD\");\n \thead->object.flags |= UNINTERESTING;\n@@ -355,8 +355,8 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n \t\thead = lookup_commit(head_sha1);\n \t\tinit_revisions(&rev, prefix);\n \t\trev.commit_format = CMIT_FMT_ONELINE;\n-\t\trev.ignore_merges = 1;\n-\t\trev.limited = 1;\n+\t\tREV_DIFF_SET(&rev, IGNORE_MERGES);\n+\t\tREV_TRAV_SET(&rev, LIMITED);\n \n \t\tfor (i = 0; i < origins.nr; i++)\n \t\t\tshortlog(origins.list[i], origins.payload[i],\ndiff --git a/builtin-log.c b/builtin-log.c\nindex dde7192..be8f5b9 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -60,9 +60,13 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,\n \trev->commit_format = CMIT_FMT_DEFAULT;\n \tif (fmt_pretty)\n \t\tget_commit_format(fmt_pretty, rev);\n-\trev->verbose_header = 1;\n \tDIFF_OPT_SET(&rev->diffopt, RECURSIVE);\n-\trev->show_root_diff = default_show_root;\n+\tREV_DIFF_SET(rev, VERBOSE_HEADER);\n+\tif (default_show_root) {\n+\t\tREV_DIFF_SET(rev, SHOW_ROOT_DIFF);\n+\t} else {\n+\t\tREV_DIFF_CLR(rev, SHOW_ROOT_DIFF);\n+\t}\n \trev->subject_prefix = fmt_patch_subject_prefix;\n \n \tif (default_date_mode)\n@@ -71,9 +75,9 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,\n \targc = parse_revisions(argc, argv, rev);\n \tsetup_revisions(rev, \"HEAD\");\n \tif (rev->diffopt.pickaxe || rev->diffopt.filter)\n-\t\trev->always_show_header = 0;\n+\t\tREV_DIFF_CLR(rev, ALWAYS_SHOW_HEADER);\n \tif (DIFF_OPT_TST(&rev->diffopt, FOLLOW_RENAMES)) {\n-\t\trev->always_show_header = 0;\n+\t\tREV_DIFF_CLR(rev, ALWAYS_SHOW_HEADER);\n \t\tif (rev->diffopt.nr_paths != 1)\n \t\t\tusage(\"git logs can only follow renames on one pathname at a time\");\n \t}\n@@ -108,8 +112,8 @@ static int estimate_commit_count(struct rev_info *rev, struct commit_list *list)\n \n static void show_early_header(struct rev_info *rev, const char *stage, int nr)\n {\n-\tif (rev->shown_one) {\n-\t\trev->shown_one = 0;\n+\tif (REV_FMT_TST(rev, SHOWN_ONE)) {\n+\t\tREV_FMT_CLR(rev, SHOWN_ONE);\n \t\tif (rev->commit_format != CMIT_FMT_ONELINE)\n \t\t\tputchar(rev->diffopt.line_termination);\n \t}\n@@ -123,7 +127,7 @@ static void log_show_early(struct rev_info *revs, struct commit_list *list)\n \tint i = revs->early_output;\n \tint show_header = 1;\n \n-\tsort_in_topological_order(&list, revs->lifo);\n+\tsort_in_topological_order(&list, REV_TRAV_TST(revs, LIFO));\n \twhile (list && i) {\n \t\tstruct commit *commit = list->item;\n \t\tswitch (simplify_commit(revs, commit)) {\n@@ -259,8 +263,8 @@ int cmd_whatchanged(int argc, const char **argv, const char *prefix)\n \t\tdiff_use_color_default = git_use_color_default;\n \n \tinit_revisions(&rev, prefix);\n-\trev.diff = 1;\n-\trev.simplify_history = 0;\n+\tREV_DIFF_SET(&rev, DIFF);\n+\tREV_TRAV_CLR(&rev, SIMPLIFY_HISTORY);\n \tcmd_log_init(argc, argv, prefix, &rev);\n \tif (!rev.diffopt.output_format)\n \t\trev.diffopt.output_format = DIFF_FORMAT_RAW;\n@@ -335,12 +339,12 @@ int cmd_show(int argc, const char **argv, const char *prefix)\n \t\tdiff_use_color_default = git_use_color_default;\n \n \tinit_revisions(&rev, prefix);\n-\trev.diff = 1;\n-\trev.combine_merges = 1;\n-\trev.dense_combined_merges = 1;\n-\trev.always_show_header = 1;\n-\trev.ignore_merges = 0;\n-\trev.no_walk = 1;\n+\tREV_DIFF_SET(&rev, DIFF);\n+\tREV_DIFF_SET(&rev, COMBINE_MERGES);\n+\tREV_DIFF_SET(&rev, DENSE_COMBINED_MERGES);\n+\tREV_DIFF_SET(&rev, ALWAYS_SHOW_HEADER);\n+\tREV_DIFF_CLR(&rev, IGNORE_MERGES);\n+\tREV_TRAV_SET(&rev, NO_WALK);\n \tcmd_log_init(argc, argv, prefix, &rev);\n \n \tcount = rev.pending.nr;\n@@ -400,8 +404,8 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)\n \n \tinit_revisions(&rev, prefix);\n \tinit_reflog_walk(&rev.reflog_info);\n-\trev.abbrev_commit = 1;\n-\trev.verbose_header = 1;\n+\tREV_FMT_SET(&rev, ABBREV_COMMIT);\n+\tREV_DIFF_SET(&rev, VERBOSE_HEADER);\n \tcmd_log_init(argc, argv, prefix, &rev);\n \n \t/*\n@@ -410,8 +414,8 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)\n \t * allow us to set a different default.\n \t */\n \trev.commit_format = CMIT_FMT_ONELINE;\n-\trev.use_terminator = 1;\n-\trev.always_show_header = 1;\n+\tREV_FMT_SET(&rev, USE_TERMINATOR);\n+\tREV_DIFF_SET(&rev, ALWAYS_SHOW_HEADER);\n \n \t/*\n \t * We get called through \"git reflog\", so unlike the other log\n@@ -432,7 +436,7 @@ int cmd_log(int argc, const char **argv, const char *prefix)\n \t\tdiff_use_color_default = git_use_color_default;\n \n \tinit_revisions(&rev, prefix);\n-\trev.always_show_header = 1;\n+\tREV_DIFF_SET(&rev, ALWAYS_SHOW_HEADER);\n \tcmd_log_init(argc, argv, prefix, &rev);\n \treturn cmd_log_walk(&rev);\n }\n@@ -784,10 +788,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \tgit_config(git_format_config, NULL);\n \tinit_revisions(&rev, prefix);\n \trev.commit_format = CMIT_FMT_EMAIL;\n-\trev.verbose_header = 1;\n-\trev.diff = 1;\n-\trev.combine_merges = 0;\n-\trev.ignore_merges = 1;\n+\tREV_DIFF_SET(&rev, VERBOSE_HEADER);\n+\tREV_DIFF_SET(&rev, DIFF);\n+\tREV_DIFF_CLR(&rev, COMBINE_MERGES);\n+\tREV_DIFF_SET(&rev, IGNORE_MERGES);\n \tDIFF_OPT_SET(&rev.diffopt, RECURSIVE);\n \n \trev.subject_prefix = fmt_patch_subject_prefix;\n@@ -950,7 +954,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \t}\n \n \tif (rev.pending.nr == 1) {\n-\t\tif (rev.max_count < 0 && !rev.show_root_diff) {\n+\t\tif (rev.max_count < 0 && !REV_DIFF_TST(&rev, SHOW_ROOT_DIFF)) {\n \t\t\t/*\n \t\t\t * This is traditional behaviour of \"git format-patch\n \t\t\t * origin\" that prepares what the origin side still\n@@ -986,7 +990,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \n \tif (prepare_revision_walk(&rev))\n \t\tdie(\"revision walk setup failed\");\n-\trev.boundary = 1;\n+\tREV_TRAV_SET(&rev, BOUNDARY);\n \twhile ((commit = get_revision(&rev)) != NULL) {\n \t\tif (commit->object.flags & BOUNDARY) {\n \t\t\tboundary_count++;\n@@ -1058,7 +1062,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \t\t * not want the extra blank line.\n \t\t */\n \t\tif (!use_stdout)\n-\t\t\trev.shown_one = 0;\n+\t\t\tREV_FMT_CLR(&rev, SHOWN_ONE);\n \t\tif (shown) {\n \t\t\tif (rev.mime_boundary)\n \t\t\t\tprintf(\"\\n--%s%s--\\n\\n\\n\",\n@@ -1124,9 +1128,9 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)\n \t}\n \n \tinit_revisions(&revs, prefix);\n-\trevs.diff = 1;\n-\trevs.combine_merges = 0;\n-\trevs.ignore_merges = 1;\n+\tREV_DIFF_SET(&revs, DIFF);\n+\tREV_DIFF_CLR(&revs, COMBINE_MERGES);\n+\tREV_DIFF_SET(&revs, IGNORE_MERGES);\n \tDIFF_OPT_SET(&revs.diffopt, RECURSIVE);\n \n \tif (add_pending_commit(head, &revs, 0))\ndiff --git a/builtin-rev-list.c b/builtin-rev-list.c\nindex ed60227..db61872 100644\n--- a/builtin-rev-list.c\n+++ b/builtin-rev-list.c\n@@ -72,19 +72,19 @@ static void show_commit(struct commit *commit)\n \t\t\tputchar('-');\n \t\telse if (commit->object.flags & UNINTERESTING)\n \t\t\tputchar('^');\n-\t\telse if (revs.left_right) {\n+\t\telse if (REV_TRAV_TST(&revs, LEFT_RIGHT)) {\n \t\t\tif (commit->object.flags & SYMMETRIC_LEFT)\n \t\t\t\tputchar('<');\n \t\t\telse\n \t\t\t\tputchar('>');\n \t\t}\n \t}\n-\tif (revs.abbrev_commit && revs.abbrev)\n+\tif (REV_FMT_TST(&revs, ABBREV_COMMIT) && revs.abbrev)\n \t\tfputs(find_unique_abbrev(commit->object.sha1, revs.abbrev),\n \t\t      stdout);\n \telse\n \t\tfputs(sha1_to_hex(commit->object.sha1), stdout);\n-\tif (revs.print_parents) {\n+\tif (REV_TRAV_TST(&revs, PRINT_PARENTS)) {\n \t\tstruct commit_list *parents = commit->parents;\n \t\twhile (parents) {\n \t\t\tprintf(\" %s\", sha1_to_hex(parents->item->object.sha1));\n@@ -106,7 +106,7 @@ static void show_commit(struct commit *commit)\n \telse\n \t\tputchar('\\n');\n \n-\tif (revs.verbose_header && commit->buffer) {\n+\tif (REV_DIFF_TST(&revs, VERBOSE_HEADER) && commit->buffer) {\n \t\tstruct strbuf buf;\n \t\tstrbuf_init(&buf, 0);\n \t\tpretty_print_commit(revs.commit_format, commit,\n@@ -612,7 +612,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n \t\tconst char *arg = argv[i];\n \n \t\tif (!strcmp(arg, \"--header\")) {\n-\t\t\trevs.verbose_header = 1;\n+\t\t\tREV_DIFF_SET(&revs, VERBOSE_HEADER);\n \t\t\tcontinue;\n \t\t}\n \t\tif (!strcmp(arg, \"--timestamp\")) {\n@@ -654,25 +654,26 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n \t\telse\n \t\t\theader_prefix = \"commit \";\n \t}\n-\telse if (revs.verbose_header)\n+\telse if (REV_DIFF_TST(&revs, VERBOSE_HEADER))\n \t\t/* Only --header was specified */\n \t\trevs.commit_format = CMIT_FMT_RAW;\n \n \tlist = revs.commits;\n \n \tif ((!list &&\n-\t     (!(revs.tag_objects||revs.tree_objects||revs.blob_objects) &&\n-\t      !revs.pending.nr)) ||\n-\t    revs.diff)\n+\t\t (!(REV_TRAV_TST(&revs, TAG_OBJECTS) ||\n+\t\t\tREV_TRAV_TST(&revs, TREE_OBJECTS) ||\n+\t\t\tREV_TRAV_TST(&revs, BLOB_OBJECTS)) &&\n+\t      !revs.pending.nr)) || REV_DIFF_TST(&revs, DIFF))\n \t\tusage(rev_list_usage);\n \n-\tsave_commit_buffer = revs.verbose_header || revs.grep_filter;\n+\tsave_commit_buffer = REV_DIFF_TST(&revs, VERBOSE_HEADER) || revs.grep_filter;\n \tif (bisect_list)\n-\t\trevs.limited = 1;\n+\t\tREV_TRAV_SET(&revs, LIMITED);\n \n \tif (prepare_revision_walk(&revs))\n \t\tdie(\"revision walk setup failed\");\n-\tif (revs.tree_objects)\n+\tif (REV_TRAV_TST(&revs, TREE_OBJECTS))\n \t\tmark_edges_uninteresting(revs.commits, &revs, show_edge);\n \n \tif (bisect_list) {\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 588c58b..9b32bcf 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -796,7 +796,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,\n \t\tint added = 0;\n \t\tint deleted = 0;\n \n-\t\tif (rev->loginfo && !rev->no_commit_id)\n+\t\tif (rev->loginfo && !REV_DIFF_TST(rev, NO_COMMIT_ID))\n \t\t\tshow_log(rev);\n \t\tdump_quoted_path(dense ? \"diff --cc \" : \"diff --combined \",\n \t\t\t\t \"\", elem->path, c_meta, c_reset);\n@@ -879,7 +879,7 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re\n \tif (!line_termination)\n \t\tinter_name_termination = 0;\n \n-\tif (rev->loginfo && !rev->no_commit_id)\n+\tif (rev->loginfo && !REV_DIFF_TST(rev, NO_COMMIT_ID))\n \t\tshow_log(rev);\n \n \tif (opt->output_format & DIFF_FORMAT_RAW) {\n@@ -943,7 +943,7 @@ void diff_tree_combined(const unsigned char *sha1,\n \tDIFF_OPT_SET(&diffopts, RECURSIVE);\n \tDIFF_OPT_CLR(&diffopts, ALLOW_EXTERNAL);\n \n-\tshow_log_first = !!rev->loginfo && !rev->no_commit_id;\n+\tshow_log_first = !!rev->loginfo && !REV_DIFF_TST(rev, NO_COMMIT_ID);\n \tneedsep = 0;\n \t/* find set of paths that everybody touches */\n \tfor (i = 0; i < num_parent; i++) {\n@@ -962,7 +962,7 @@ void diff_tree_combined(const unsigned char *sha1,\n \n \t\tif (show_log_first && i == 0) {\n \t\t\tshow_log(rev);\n-\t\t\tif (rev->verbose_header && opt->output_format)\n+\t\t\tif (REV_DIFF_TST(rev, VERBOSE_HEADER) && opt->output_format)\n \t\t\t\tputchar(opt->line_termination);\n \t\t}\n \t\tdiff_flush(&diffopts);\ndiff --git a/diff-lib.c b/diff-lib.c\nindex b17722d..777b98f 100644\n--- a/diff-lib.c\n+++ b/diff-lib.c\n@@ -140,9 +140,9 @@ int run_diff_files(struct rev_info *revs, unsigned int option)\n \t\t\t */\n \t\t\ti--;\n \n-\t\t\tif (revs->combine_merges && num_compare_stages == 2) {\n+\t\t\tif (REV_DIFF_TST(revs, COMBINE_MERGES) && num_compare_stages == 2) {\n \t\t\t\tshow_combined_diff(dpath, 2,\n-\t\t\t\t\t\t   revs->dense_combined_merges,\n+\t\t\t\t\t\t   REV_DIFF_TST(revs, DENSE_COMBINED_MERGES),\n \t\t\t\t\t\t   revs);\n \t\t\t\tfree(dpath);\n \t\t\t\tcontinue;\n@@ -281,7 +281,7 @@ static int show_modified(struct oneway_unpack_data *cbdata,\n \t\treturn -1;\n \t}\n \n-\tif (revs->combine_merges && !cached &&\n+\tif (REV_DIFF_TST(revs, COMBINE_MERGES) && !cached &&\n \t    (hashcmp(sha1, old->sha1) || hashcmp(old->sha1, new->sha1))) {\n \t\tstruct combine_diff_path *p;\n \t\tint pathlen = ce_namelen(new);\n@@ -301,7 +301,7 @@ static int show_modified(struct oneway_unpack_data *cbdata,\n \t\tp->parent[1].status = DIFF_STATUS_MODIFIED;\n \t\tp->parent[1].mode = old->ce_mode;\n \t\thashcpy(p->parent[1].sha1, old->sha1);\n-\t\tshow_combined_diff(p, 2, revs->dense_combined_merges, revs);\n+\t\tshow_combined_diff(p, 2, REV_DIFF_TST(revs, DENSE_COMBINED_MERGES), revs);\n \t\tfree(p);\n \t\treturn 0;\n \t}\n@@ -354,7 +354,7 @@ static void do_oneway_diff(struct unpack_trees_options *o,\n \t * \"!revs->ignore_merges\".\n \t */\n \tcached = o->index_only;\n-\tmatch_missing = !revs->ignore_merges;\n+\tmatch_missing = !REV_DIFF_TST(revs, IGNORE_MERGES);\n \n \tif (cached && idx && ce_stage(idx)) {\n \t\tif (tree)\ndiff --git a/graph.c b/graph.c\nindex 26b8c52..1173440 100644\n--- a/graph.c\n+++ b/graph.c\n@@ -196,7 +196,8 @@ static int graph_is_interesting(struct git_graph *graph, struct commit *commit)\n \t * been shown are always interesting, even if they have the\n \t * UNINTERESTING or TREESAME flags set.\n \t */\n-\tif (graph->revs && graph->revs->boundary) {\n+\tif (graph->revs && (REV_TRAV_TST(graph->revs, BOUNDARY)\n+\t\t\t|| REV_TRAV_TST(graph->revs, BOUNDARY_OUTPUT))) {\n \t\tif (commit->object.flags & CHILD_SHOWN)\n \t\t\treturn 1;\n \t}\n@@ -557,10 +558,11 @@ static void graph_output_commit_char(struct git_graph *graph, struct strbuf *sb)\n {\n \t/*\n \t * For boundary commits, print 'o'\n-\t * (We should only see boundary commits when revs->boundary is set.)\n+\t * (We should only see boundary commits when BOUNDARY/BOUNDARY_OUTPUT is set.)\n \t */\n \tif (graph->commit->object.flags & BOUNDARY) {\n-\t\tassert(graph->revs->boundary);\n+\t\tassert (REV_TRAV_TST(graph->revs, BOUNDARY)\n+\t\t\t\t|| REV_TRAV_TST(graph->revs, BOUNDARY_OUTPUT));\n \t\tstrbuf_addch(sb, 'o');\n \t\treturn;\n \t}\n@@ -570,7 +572,7 @@ static void graph_output_commit_char(struct git_graph *graph, struct strbuf *sb)\n \t * come from the left side, and '>' for commits from the right\n \t * side.\n \t */\n-\tif (graph->revs && graph->revs->left_right) {\n+\tif (graph->revs && REV_TRAV_TST(graph->revs, LEFT_RIGHT)) {\n \t\tif (graph->commit->object.flags & SYMMETRIC_LEFT)\n \t\t\tstrbuf_addch(sb, '<');\n \t\telse\ndiff --git a/list-objects.c b/list-objects.c\nindex c8b8375..b15af12 100644\n--- a/list-objects.c\n+++ b/list-objects.c\n@@ -16,7 +16,7 @@ static void process_blob(struct rev_info *revs,\n {\n \tstruct object *obj = &blob->object;\n \n-\tif (!revs->blob_objects)\n+\tif (!REV_TRAV_TST(revs, BLOB_OBJECTS))\n \t\treturn;\n \tif (!obj)\n \t\tdie(\"bad blob object\");\n@@ -69,7 +69,7 @@ static void process_tree(struct rev_info *revs,\n \tstruct name_entry entry;\n \tstruct name_path me;\n \n-\tif (!revs->tree_objects)\n+\tif (!REV_TRAV_TST(revs, TREE_OBJECTS))\n \t\treturn;\n \tif (!obj)\n \t\tdie(\"bad tree object\");\n@@ -114,7 +114,7 @@ static void mark_edge_parents_uninteresting(struct commit *commit,\n \t\tif (!(parent->object.flags & UNINTERESTING))\n \t\t\tcontinue;\n \t\tmark_tree_uninteresting(parent->tree);\n-\t\tif (revs->edge_hint && !(parent->object.flags & SHOWN)) {\n+\t\tif (REV_TRAV_TST(revs, EDGE_HINT) && !(parent->object.flags & SHOWN)) {\n \t\t\tparent->object.flags |= SHOWN;\n \t\t\tshow_edge(parent);\n \t\t}\ndiff --git a/log-tree.c b/log-tree.c\nindex 5505606..e2ee3ec 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -220,12 +220,12 @@ void show_log(struct rev_info *opt)\n \tstruct log_info *log = opt->loginfo;\n \tstruct commit *commit = log->commit, *parent = log->parent;\n \tint abbrev = opt->diffopt.abbrev;\n-\tint abbrev_commit = opt->abbrev_commit ? opt->abbrev : 40;\n+\tint abbrev_commit = REV_FMT_TST(opt, ABBREV_COMMIT) ? opt->abbrev : 40;\n \tconst char *subject = NULL, *extra_headers = opt->extra_headers;\n \tint need_8bit_cte = 0;\n \n \topt->loginfo = NULL;\n-\tif (!opt->verbose_header) {\n+\tif (!REV_DIFF_TST(opt, VERBOSE_HEADER)) {\n \t\tgraph_show_commit(opt->graph);\n \n \t\tif (!opt->graph) {\n@@ -233,7 +233,7 @@ void show_log(struct rev_info *opt)\n \t\t\t\tputchar('-');\n \t\t\telse if (commit->object.flags & UNINTERESTING)\n \t\t\t\tputchar('^');\n-\t\t\telse if (opt->left_right) {\n+\t\t\telse if (REV_TRAV_TST(opt, LEFT_RIGHT)) {\n \t\t\t\tif (commit->object.flags & SYMMETRIC_LEFT)\n \t\t\t\t\tputchar('<');\n \t\t\t\telse\n@@ -241,7 +241,7 @@ void show_log(struct rev_info *opt)\n \t\t\t}\n \t\t}\n \t\tfputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);\n-\t\tif (opt->print_parents)\n+\t\tif (REV_TRAV_TST(opt, PRINT_PARENTS))\n \t\t\tshow_parents(commit, abbrev_commit);\n \t\tshow_decorations(commit);\n \t\tif (opt->graph && !graph_is_commit_finished(opt->graph)) {\n@@ -257,7 +257,7 @@ void show_log(struct rev_info *opt)\n \t * Otherwise, add a diffopt.line_termination character before all\n \t * entries but the first.  (IOW, as a separator between entries)\n \t */\n-\tif (opt->shown_one && !opt->use_terminator) {\n+\tif (REV_FMT_TST(opt, SHOWN_ONE) && !REV_FMT_TST(opt, USE_TERMINATOR)) {\n \t\t/*\n \t\t * If entries are separated by a newline, the output\n \t\t * should look human-readable.  If the last entry ended\n@@ -271,11 +271,11 @@ void show_log(struct rev_info *opt)\n \t\t * separator.\n \t\t */\n \t\tif (opt->diffopt.line_termination == '\\n' &&\n-\t\t    !opt->missing_newline)\n+\t\t\t!REV_FMT_TST(opt, MISSING_NEWLINE))\n \t\t\tgraph_show_padding(opt->graph);\n \t\tputchar(opt->diffopt.line_termination);\n \t}\n-\topt->shown_one = 1;\n+\tREV_FMT_SET(opt, SHOWN_ONE);\n \n \t/*\n \t * If the history graph was requested,\n@@ -301,7 +301,7 @@ void show_log(struct rev_info *opt)\n \t\t\t\tputchar('-');\n \t\t\telse if (commit->object.flags & UNINTERESTING)\n \t\t\t\tputchar('^');\n-\t\t\telse if (opt->left_right) {\n+\t\t\telse if (REV_TRAV_TST(opt, LEFT_RIGHT)) {\n \t\t\t\tif (commit->object.flags & SYMMETRIC_LEFT)\n \t\t\t\t\tputchar('<');\n \t\t\t\telse\n@@ -310,7 +310,7 @@ void show_log(struct rev_info *opt)\n \t\t}\n \t\tfputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit),\n \t\t      stdout);\n-\t\tif (opt->print_parents)\n+\t\tif (REV_TRAV_TST(opt, PRINT_PARENTS))\n \t\t\tshow_parents(commit, abbrev_commit);\n \t\tif (parent)\n \t\t\tprintf(\" (from %s)\",\n@@ -364,16 +364,16 @@ void show_log(struct rev_info *opt)\n \t * end in a newline (including if it is empty)\n \t */\n \tif (!msgbuf.len || msgbuf.buf[msgbuf.len - 1] != '\\n')\n-\t\topt->missing_newline = 1;\n+\t\tREV_FMT_SET(opt, MISSING_NEWLINE);\n \telse\n-\t\topt->missing_newline = 0;\n+\t\tREV_FMT_CLR(opt, MISSING_NEWLINE);\n \n \tif (opt->graph)\n \t\tgraph_show_commit_msg(opt->graph, &msgbuf);\n \telse\n \t\tfwrite(msgbuf.buf, sizeof(char), msgbuf.len, stdout);\n-\tif (opt->use_terminator) {\n-\t\tif (!opt->missing_newline)\n+\tif (REV_FMT_TST(opt, USE_TERMINATOR)) {\n+\t\tif (!REV_FMT_TST(opt, MISSING_NEWLINE))\n \t\t\tgraph_show_padding(opt->graph);\n \t\tputchar('\\n');\n \t}\n@@ -393,7 +393,7 @@ int log_tree_diff_flush(struct rev_info *opt)\n \t\treturn 0;\n \t}\n \n-\tif (opt->loginfo && !opt->no_commit_id) {\n+\tif (opt->loginfo && !REV_DIFF_TST(opt, NO_COMMIT_ID)) {\n \t\t/* When showing a verbose header (i.e. log message),\n \t\t * and not in --pretty=oneline format, we would want\n \t\t * an extra newline between the end of log and the\n@@ -401,7 +401,7 @@ int log_tree_diff_flush(struct rev_info *opt)\n \t\t */\n \t\tshow_log(opt);\n \t\tif ((opt->diffopt.output_format & ~DIFF_FORMAT_NO_OUTPUT) &&\n-\t\t    opt->verbose_header &&\n+\t\t    REV_DIFF_TST(opt, VERBOSE_HEADER) &&\n \t\t    opt->commit_format != CMIT_FMT_ONELINE) {\n \t\t\tint pch = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH;\n \t\t\tif ((pch & opt->diffopt.output_format) == pch)\n@@ -417,7 +417,7 @@ static int do_diff_combined(struct rev_info *opt, struct commit *commit)\n {\n \tunsigned const char *sha1 = commit->object.sha1;\n \n-\tdiff_tree_combined_merge(sha1, opt->dense_combined_merges, opt);\n+\tdiff_tree_combined_merge(sha1, REV_DIFF_TST(opt, DENSE_COMBINED_MERGES), opt);\n \treturn !opt->loginfo;\n }\n \n@@ -432,13 +432,13 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log\n \tstruct commit_list *parents;\n \tunsigned const char *sha1 = commit->object.sha1;\n \n-\tif (!opt->diff)\n+\tif (!REV_DIFF_TST(opt, DIFF))\n \t\treturn 0;\n \n \t/* Root commit? */\n \tparents = commit->parents;\n \tif (!parents) {\n-\t\tif (opt->show_root_diff) {\n+\t\tif (REV_DIFF_TST(opt, SHOW_ROOT_DIFF)) {\n \t\t\tdiff_root_tree_sha1(sha1, \"\", &opt->diffopt);\n \t\t\tlog_tree_diff_flush(opt);\n \t\t}\n@@ -447,9 +447,9 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log\n \n \t/* More than one parent? */\n \tif (parents && parents->next) {\n-\t\tif (opt->ignore_merges)\n+\t\tif (REV_DIFF_TST(opt, IGNORE_MERGES))\n \t\t\treturn 0;\n-\t\telse if (opt->combine_merges)\n+\t\telse if (REV_DIFF_TST(opt, COMBINE_MERGES))\n \t\t\treturn do_diff_combined(opt, commit);\n \n \t\t/* If we show individual diffs, show the parent info */\n@@ -485,7 +485,7 @@ int log_tree_commit(struct rev_info *opt, struct commit *commit)\n \topt->loginfo = &log;\n \n \tshown = log_tree_diff(opt, commit, &log);\n-\tif (!shown && opt->loginfo && opt->always_show_header) {\n+\tif (!shown && opt->loginfo && REV_DIFF_TST(opt, ALWAYS_SHOW_HEADER)) {\n \t\tlog.parent = NULL;\n \t\tshow_log(opt);\n \t\tshown = 1;\ndiff --git a/pretty.c b/pretty.c\nindex 8eb39e9..38a9099 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -23,7 +23,7 @@ void get_commit_format(const char *arg, struct rev_info *rev)\n \t\t{ \"oneline\",\t1,\tCMIT_FMT_ONELINE },\n \t};\n \n-\trev->use_terminator = 0;\n+\tREV_FMT_CLR(rev, USE_TERMINATOR);\n \tif (!arg || !*arg) {\n \t\trev->commit_format = CMIT_FMT_DEFAULT;\n \t\treturn;\n@@ -33,7 +33,7 @@ void get_commit_format(const char *arg, struct rev_info *rev)\n \t\tfree(user_format);\n \t\tuser_format = xstrdup(cp);\n \t\tif (arg[0] == 't')\n-\t\t\trev->use_terminator = 1;\n+\t\t\tREV_FMT_SET(rev, USE_TERMINATOR);\n \t\trev->commit_format = CMIT_FMT_USERFORMAT;\n \t\treturn;\n \t}\n@@ -41,7 +41,7 @@ void get_commit_format(const char *arg, struct rev_info *rev)\n \t\tif (!strncmp(arg, cmt_fmts[i].n, cmt_fmts[i].cmp_len) &&\n \t\t    !strncmp(arg, cmt_fmts[i].n, strlen(arg))) {\n \t\t\tif (cmt_fmts[i].v == CMIT_FMT_ONELINE)\n-\t\t\t\trev->use_terminator = 1;\n+\t\t\t\tREV_FMT_SET(rev, USE_TERMINATOR);\n \t\t\trev->commit_format = cmt_fmts[i].v;\n \t\t\treturn;\n \t\t}\ndiff --git a/reachable.c b/reachable.c\nindex 3b1c18f..6ee77f9 100644\n--- a/reachable.c\n+++ b/reachable.c\n@@ -203,9 +203,9 @@ void mark_reachable_objects(struct rev_info *revs, int mark_reflog)\n \t * Set up revision parsing, and mark us as being interested\n \t * in all object types, not just commits.\n \t */\n-\trevs->tag_objects = 1;\n-\trevs->blob_objects = 1;\n-\trevs->tree_objects = 1;\n+\tREV_TRAV_SET(revs, TAG_OBJECTS);\n+\tREV_TRAV_SET(revs, BLOB_OBJECTS);\n+\tREV_TRAV_SET(revs, TREE_OBJECTS);\n \n \t/* Add all refs from the index file */\n \tadd_cache_refs(revs);\ndiff --git a/revision.c b/revision.c\nindex 4abe410..89036e7 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -131,7 +131,7 @@ void mark_parents_uninteresting(struct commit *commit)\n \n static void add_pending_object_with_mode(struct rev_info *revs, struct object *obj, const char *name, unsigned mode)\n {\n-\tif (revs->no_walk && (obj->flags & UNINTERESTING))\n+\tif (REV_TRAV_TST(revs, NO_WALK) && (obj->flags & UNINTERESTING))\n \t\tdie(\"object ranges do not make sense when not walking revisions\");\n \tif (revs->reflog_info && obj->type == OBJ_COMMIT &&\n \t\t\tadd_reflog_for_walk(revs->reflog_info,\n@@ -177,7 +177,7 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object\n \t */\n \twhile (object->type == OBJ_TAG) {\n \t\tstruct tag *tag = (struct tag *) object;\n-\t\tif (revs->tag_objects && !(flags & UNINTERESTING))\n+\t\tif (REV_TRAV_TST(revs, TAG_OBJECTS) && !(flags & UNINTERESTING))\n \t\t\tadd_pending_object(revs, object, tag->tag);\n \t\tif (!tag->tagged)\n \t\t\tdie(\"bad tag\");\n@@ -197,7 +197,7 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object\n \t\tif (flags & UNINTERESTING) {\n \t\t\tcommit->object.flags |= UNINTERESTING;\n \t\t\tmark_parents_uninteresting(commit);\n-\t\t\trevs->limited = 1;\n+\t\t\tREV_TRAV_SET(revs, LIMITED);\n \t\t}\n \t\treturn commit;\n \t}\n@@ -208,7 +208,7 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object\n \t */\n \tif (object->type == OBJ_TREE) {\n \t\tstruct tree *tree = (struct tree *)object;\n-\t\tif (!revs->tree_objects)\n+\t\tif (!REV_TRAV_TST(revs, TREE_OBJECTS))\n \t\t\treturn NULL;\n \t\tif (flags & UNINTERESTING) {\n \t\t\tmark_tree_uninteresting(tree);\n@@ -223,7 +223,7 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object\n \t */\n \tif (object->type == OBJ_BLOB) {\n \t\tstruct blob *blob = (struct blob *)object;\n-\t\tif (!revs->blob_objects)\n+\t\tif (!REV_TRAV_TST(revs, BLOB_OBJECTS))\n \t\t\treturn NULL;\n \t\tif (flags & UNINTERESTING) {\n \t\t\tmark_blob_uninteresting(blob);\n@@ -338,7 +338,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)\n \t/*\n \t * If we don't do pruning, everything is interesting\n \t */\n-\tif (!revs->prune)\n+\tif (!REV_TRAV_TST(revs, PRUNE))\n \t\treturn;\n \n \tif (!commit->tree)\n@@ -354,7 +354,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)\n \t * Normal non-merge commit? If we don't want to make the\n \t * history dense, we consider it always to be a change..\n \t */\n-\tif (!revs->dense && !commit->parents->next)\n+\tif (!REV_TRAV_TST(revs, DENSE) && !commit->parents->next)\n \t\treturn;\n \n \tpp = &commit->parents;\n@@ -368,7 +368,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)\n \t\tswitch (rev_compare_tree(revs, p->tree, commit->tree)) {\n \t\tcase REV_TREE_SAME:\n \t\t\ttree_same = 1;\n-\t\t\tif (!revs->simplify_history || (p->object.flags & UNINTERESTING)) {\n+\t\t\tif (!REV_TRAV_TST(revs, SIMPLIFY_HISTORY) || (p->object.flags & UNINTERESTING)) {\n \t\t\t\t/* Even if a merge with an uninteresting\n \t\t\t\t * side branch brought the entire change\n \t\t\t\t * we are interested in, we do not want\n@@ -384,7 +384,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)\n \t\t\treturn;\n \n \t\tcase REV_TREE_NEW:\n-\t\t\tif (revs->remove_empty_trees &&\n+\t\t\tif (REV_TRAV_TST(revs, REMOVE_EMPTY_TREES) &&\n \t\t\t    rev_same_tree_as_empty(revs, p->tree)) {\n \t\t\t\t/* We are adding all the specified\n \t\t\t\t * paths from this parent, so the\n@@ -458,7 +458,7 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit, str\n \t */\n \ttry_to_simplify_commit(revs, commit);\n \n-\tif (revs->no_walk)\n+\tif (REV_TRAV_TST(revs, NO_WALK))\n \t\treturn 0;\n \n \tleft_flag = (commit->object.flags & SYMMETRIC_LEFT);\n@@ -473,7 +473,7 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit, str\n \t\t\tp->object.flags |= SEEN;\n \t\t\tinsert_by_date(p, list);\n \t\t}\n-\t\tif(revs->first_parent_only)\n+\t\tif (REV_TRAV_TST(revs, FIRST_PARENT_ONLY))\n \t\t\tbreak;\n \t}\n \treturn 0;\n@@ -616,13 +616,13 @@ static int limit_list(struct rev_info *revs)\n \t\t\treturn -1;\n \t\tif (obj->flags & UNINTERESTING) {\n \t\t\tmark_parents_uninteresting(commit);\n-\t\t\tif (revs->show_all)\n+\t\t\tif (REV_TRAV_TST(revs, SHOW_ALL))\n \t\t\t\tp = &commit_list_insert(commit, p)->next;\n \t\t\tslop = still_interesting(list, date, slop);\n \t\t\tif (slop)\n \t\t\t\tcontinue;\n \t\t\t/* If showing all, add the whole pending list to the end */\n-\t\t\tif (revs->show_all)\n+\t\t\tif (REV_TRAV_TST(revs, SHOW_ALL))\n \t\t\t\t*p = list;\n \t\t\tbreak;\n \t\t}\n@@ -638,7 +638,7 @@ static int limit_list(struct rev_info *revs)\n \t\tshow(revs, newlist);\n \t\tshow_early_output = NULL;\n \t}\n-\tif (revs->cherry_pick)\n+\tif (REV_TRAV_TST(revs, CHERRY_PICK))\n \t\tcherry_pick_list(newlist, revs);\n \n \trevs->commits = newlist;\n@@ -750,14 +750,14 @@ void init_revisions(struct rev_info *revs, const char *prefix)\n \tmemset(revs, 0, sizeof(*revs));\n \n \trevs->abbrev = DEFAULT_ABBREV;\n-\trevs->ignore_merges = 1;\n-\trevs->simplify_history = 1;\n+\tREV_DIFF_SET(revs, IGNORE_MERGES);\n \tDIFF_OPT_SET(&revs->pruning, RECURSIVE);\n \tDIFF_OPT_SET(&revs->pruning, QUIET);\n \trevs->pruning.add_remove = file_add_remove;\n \trevs->pruning.change = file_change;\n-\trevs->lifo = 1;\n-\trevs->dense = 1;\n+\tREV_TRAV_SET(revs, SIMPLIFY_HISTORY);\n+\tREV_TRAV_SET(revs, LIFO);\n+\tREV_TRAV_SET(revs, DENSE);\n \trevs->prefix = prefix;\n \trevs->max_age = -1;\n \trevs->min_age = -1;\n@@ -821,7 +821,7 @@ static void prepare_show_merge(struct rev_info *revs)\n \t\t\ti++;\n \t}\n \trevs->prune_data = prune;\n-\trevs->limited = 1;\n+\tREV_TRAV_SET(revs, LIMITED);\n }\n \n int handle_revision_arg(const char *arg, struct rev_info *revs,\n@@ -1056,7 +1056,7 @@ int parse_revisions(int argc, const char **argv, struct rev_info *revs)\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--first-parent\")) {\n-\t\t\t\trevs->first_parent_only = 1;\n+\t\t\t\tREV_TRAV_SET(revs, FIRST_PARENT_ONLY);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--reflog\")) {\n@@ -1079,17 +1079,17 @@ int parse_revisions(int argc, const char **argv, struct rev_info *revs)\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--merge\")) {\n-\t\t\t\trevs->show_merge = 1;\n+\t\t\t\tREV_FMT_SET(revs, SHOW_MERGE);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--topo-order\")) {\n-\t\t\t\trevs->lifo = 1;\n-\t\t\t\trevs->topo_order = 1;\n+\t\t\t\tREV_TRAV_SET(revs, LIFO);\n+\t\t\t\tREV_TRAV_SET(revs, TOPO_ORDER);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--date-order\")) {\n-\t\t\t\trevs->lifo = 0;\n-\t\t\t\trevs->topo_order = 1;\n+\t\t\t\tREV_TRAV_CLR(revs, LIFO);\n+\t\t\t\tREV_TRAV_SET(revs, TOPO_ORDER);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!prefixcmp(arg, \"--early-output\")) {\n@@ -1099,131 +1099,131 @@ int parse_revisions(int argc, const char **argv, struct rev_info *revs)\n \t\t\t\t\tcount = atoi(arg+15);\n \t\t\t\t\t/* Fallthrough */\n \t\t\t\tcase 0:\n-\t\t\t\t\trevs->topo_order = 1;\n+\t\t\t\t\tREV_TRAV_SET(revs, TOPO_ORDER);\n \t\t\t\t\trevs->early_output = count;\n \t\t\t\t\tcontinue;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--parents\")) {\n-\t\t\t\trevs->rewrite_parents = 1;\n-\t\t\t\trevs->print_parents = 1;\n+\t\t\t\tREV_TRAV_SET(revs, REWRITE_PARENTS);\n+\t\t\t\tREV_TRAV_SET(revs, PRINT_PARENTS);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--dense\")) {\n-\t\t\t\trevs->dense = 1;\n+\t\t\t\tREV_TRAV_SET(revs, DENSE);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--sparse\")) {\n-\t\t\t\trevs->dense = 0;\n+\t\t\t\tREV_TRAV_CLR(revs, DENSE);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--show-all\")) {\n-\t\t\t\trevs->show_all = 1;\n+\t\t\t\tREV_TRAV_SET(revs, SHOW_ALL);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--remove-empty\")) {\n-\t\t\t\trevs->remove_empty_trees = 1;\n+\t\t\t\tREV_TRAV_SET(revs, REMOVE_EMPTY_TREES);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--no-merges\")) {\n-\t\t\t\trevs->no_merges = 1;\n+\t\t\t\tREV_TRAV_SET(revs, NO_MERGES);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--boundary\")) {\n-\t\t\t\trevs->boundary = 1;\n+\t\t\t\tREV_TRAV_SET(revs, BOUNDARY);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--left-right\")) {\n-\t\t\t\trevs->left_right = 1;\n+\t\t\t\tREV_TRAV_SET(revs, LEFT_RIGHT);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--cherry-pick\")) {\n-\t\t\t\trevs->cherry_pick = 1;\n-\t\t\t\trevs->limited = 1;\n+\t\t\t\tREV_TRAV_SET(revs, CHERRY_PICK);\n+\t\t\t\tREV_TRAV_SET(revs, LIMITED);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--objects\")) {\n-\t\t\t\trevs->tag_objects = 1;\n-\t\t\t\trevs->tree_objects = 1;\n-\t\t\t\trevs->blob_objects = 1;\n+\t\t\t\tREV_TRAV_SET(revs, TAG_OBJECTS);\n+\t\t\t\tREV_TRAV_SET(revs, TREE_OBJECTS);\n+\t\t\t\tREV_TRAV_SET(revs, BLOB_OBJECTS);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--objects-edge\")) {\n-\t\t\t\trevs->tag_objects = 1;\n-\t\t\t\trevs->tree_objects = 1;\n-\t\t\t\trevs->blob_objects = 1;\n-\t\t\t\trevs->edge_hint = 1;\n+\t\t\t\tREV_TRAV_SET(revs, TAG_OBJECTS);\n+\t\t\t\tREV_TRAV_SET(revs, TREE_OBJECTS);\n+\t\t\t\tREV_TRAV_SET(revs, BLOB_OBJECTS);\n+\t\t\t\tREV_TRAV_SET(revs, EDGE_HINT);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--unpacked\")) {\n-\t\t\t\trevs->unpacked = 1;\n+\t\t\t\tREV_TRAV_SET(revs, UNPACKED);\n \t\t\t\tfree(revs->ignore_packed);\n \t\t\t\trevs->ignore_packed = NULL;\n \t\t\t\trevs->num_ignore_packed = 0;\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!prefixcmp(arg, \"--unpacked=\")) {\n-\t\t\t\trevs->unpacked = 1;\n+\t\t\t\tREV_TRAV_SET(revs, UNPACKED);\n \t\t\t\tadd_ignore_packed(revs, arg+11);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"-r\")) {\n-\t\t\t\trevs->diff = 1;\n+\t\t\t\tREV_DIFF_SET(revs, DIFF);\n \t\t\t\tDIFF_OPT_SET(&revs->diffopt, RECURSIVE);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"-t\")) {\n-\t\t\t\trevs->diff = 1;\n+\t\t\t\tREV_DIFF_SET(revs, DIFF);\n \t\t\t\tDIFF_OPT_SET(&revs->diffopt, RECURSIVE);\n \t\t\t\tDIFF_OPT_SET(&revs->diffopt, TREE_IN_RECURSIVE);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"-m\")) {\n-\t\t\t\trevs->ignore_merges = 0;\n+\t\t\t\tREV_DIFF_CLR(revs, IGNORE_MERGES);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"-c\")) {\n-\t\t\t\trevs->diff = 1;\n-\t\t\t\trevs->dense_combined_merges = 0;\n-\t\t\t\trevs->combine_merges = 1;\n+\t\t\t\tREV_DIFF_SET(revs, DIFF);\n+\t\t\t\tREV_DIFF_CLR(revs, DENSE_COMBINED_MERGES);\n+\t\t\t\tREV_DIFF_SET(revs, COMBINE_MERGES);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--cc\")) {\n-\t\t\t\trevs->diff = 1;\n-\t\t\t\trevs->dense_combined_merges = 1;\n-\t\t\t\trevs->combine_merges = 1;\n+\t\t\t\tREV_DIFF_SET(revs, DIFF);\n+\t\t\t\tREV_DIFF_SET(revs, DENSE_COMBINED_MERGES);\n+\t\t\t\tREV_DIFF_SET(revs, COMBINE_MERGES);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"-v\")) {\n-\t\t\t\trevs->verbose_header = 1;\n+\t\t\t\tREV_DIFF_SET(revs, VERBOSE_HEADER);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--pretty\")) {\n-\t\t\t\trevs->verbose_header = 1;\n+\t\t\t\tREV_DIFF_SET(revs, VERBOSE_HEADER);\n \t\t\t\tget_commit_format(arg+8, revs);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!prefixcmp(arg, \"--pretty=\")) {\n-\t\t\t\trevs->verbose_header = 1;\n+\t\t\t\tREV_DIFF_SET(revs, VERBOSE_HEADER);\n \t\t\t\tget_commit_format(arg+9, revs);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--graph\")) {\n-\t\t\t\trevs->topo_order = 1;\n-\t\t\t\trevs->rewrite_parents = 1;\n+\t\t\t\tREV_TRAV_SET(revs, TOPO_ORDER);\n+\t\t\t\tREV_TRAV_SET(revs, REWRITE_PARENTS);\n \t\t\t\trevs->graph = graph_init(revs);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--root\")) {\n-\t\t\t\trevs->show_root_diff = 1;\n+\t\t\t\tREV_DIFF_SET(revs, SHOW_ROOT_DIFF);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--no-commit-id\")) {\n-\t\t\t\trevs->no_commit_id = 1;\n+\t\t\t\tREV_DIFF_SET(revs, NO_COMMIT_ID);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--always\")) {\n-\t\t\t\trevs->always_show_header = 1;\n+\t\t\t\tREV_DIFF_SET(revs, ALWAYS_SHOW_HEADER);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--no-abbrev\")) {\n@@ -1243,16 +1243,16 @@ int parse_revisions(int argc, const char **argv, struct rev_info *revs)\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--abbrev-commit\")) {\n-\t\t\t\trevs->abbrev_commit = 1;\n+\t\t\t\tREV_FMT_SET(revs, ABBREV_COMMIT);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--full-diff\")) {\n-\t\t\t\trevs->diff = 1;\n-\t\t\t\trevs->full_diff = 1;\n+\t\t\t\tREV_DIFF_SET(revs, DIFF);\n+\t\t\t\tREV_DIFF_SET(revs, FULL_DIFF);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--full-history\")) {\n-\t\t\t\trevs->simplify_history = 0;\n+\t\t\t\tREV_TRAV_CLR(revs, SIMPLIFY_HISTORY);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--relative-date\")) {\n@@ -1311,20 +1311,20 @@ int parse_revisions(int argc, const char **argv, struct rev_info *revs)\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--reverse\")) {\n-\t\t\t\trevs->reverse ^= 1;\n+\t\t\t\tREV_TRAV_XOR(revs, REVERSE);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--no-walk\")) {\n-\t\t\t\trevs->no_walk = 1;\n+\t\t\t\tREV_TRAV_SET(revs, NO_WALK);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--do-walk\")) {\n-\t\t\t\trevs->no_walk = 0;\n+\t\t\t\tREV_TRAV_CLR(revs, NO_WALK);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--children\")) {\n \t\t\t\trevs->children.name = \"children\";\n-\t\t\t\trevs->limited = 1;\n+\t\t\t\tREV_TRAV_SET(revs, LIMITED);\n \t\t\t\tcontinue;\n \t\t\t}\n \n@@ -1370,7 +1370,7 @@ void setup_revisions(struct rev_info *revs, const char *def)\n {\n \tif (revs->def == NULL)\n \t\trevs->def = def;\n-\tif (revs->show_merge)\n+\tif (REV_FMT_TST(revs, SHOW_MERGE))\n \t\tprepare_show_merge(revs);\n \tif (revs->def && !revs->pending.nr) {\n \t\tunsigned char sha1[20];\n@@ -1384,28 +1384,28 @@ void setup_revisions(struct rev_info *revs, const char *def)\n \n \t/* Did the user ask for any diff output? Run the diff! */\n \tif (revs->diffopt.output_format & ~DIFF_FORMAT_NO_OUTPUT)\n-\t\trevs->diff = 1;\n+\t\tREV_DIFF_SET(revs, DIFF);\n \n \t/* Pickaxe, diff-filter and rename following need diffs */\n \tif (revs->diffopt.pickaxe ||\n \t    revs->diffopt.filter ||\n \t    DIFF_OPT_TST(&revs->diffopt, FOLLOW_RENAMES))\n-\t\trevs->diff = 1;\n+\t\tREV_DIFF_SET(revs, DIFF);\n \n-\tif (revs->topo_order)\n-\t\trevs->limited = 1;\n+\tif (REV_TRAV_TST(revs, TOPO_ORDER))\n+\t\tREV_TRAV_SET(revs, LIMITED);\n \n \tif (revs->prune_data) {\n \t\tdiff_tree_setup_paths(revs->prune_data, &revs->pruning);\n \t\t/* Can't prune commits with rename following: the paths change.. */\n \t\tif (!DIFF_OPT_TST(&revs->diffopt, FOLLOW_RENAMES))\n-\t\t\trevs->prune = 1;\n-\t\tif (!revs->full_diff)\n+\t\t\tREV_TRAV_SET(revs, PRUNE);\n+\t\tif (!REV_DIFF_TST(revs, FULL_DIFF))\n \t\t\tdiff_tree_setup_paths(revs->prune_data, &revs->diffopt);\n \t}\n-\tif (revs->combine_merges) {\n-\t\trevs->ignore_merges = 0;\n-\t\tif (revs->dense_combined_merges && !revs->diffopt.output_format)\n+\tif (REV_DIFF_TST(revs, COMBINE_MERGES)) {\n+\t\tREV_DIFF_CLR(revs, IGNORE_MERGES);\n+\t\tif (REV_DIFF_TST(revs, DENSE_COMBINED_MERGES) && !revs->diffopt.output_format)\n \t\t\trevs->diffopt.output_format = DIFF_FORMAT_PATCH;\n \t}\n \trevs->diffopt.abbrev = revs->abbrev;\n@@ -1416,15 +1416,15 @@ void setup_revisions(struct rev_info *revs, const char *def)\n \t\tcompile_grep_patterns(revs->grep_filter);\n \t}\n \n-\tif (revs->reverse && revs->reflog_info)\n+\tif (REV_TRAV_TST(revs, REVERSE) && revs->reflog_info)\n \t\tdie(\"cannot combine --reverse with --walk-reflogs\");\n-\tif (revs->rewrite_parents && revs->children.name)\n+\tif (REV_TRAV_TST(revs, REWRITE_PARENTS) && revs->children.name)\n \t\tdie(\"cannot combine --parents and --children\");\n \n \t/*\n \t * Limitations on the graph functionality\n \t */\n-\tif (revs->reverse && revs->graph)\n+\tif (REV_TRAV_TST(revs, REVERSE) && revs->graph)\n \t\tdie(\"cannot combine --reverse with --graph\");\n \n \tif (revs->reflog_info && revs->graph)\n@@ -1472,13 +1472,13 @@ int prepare_revision_walk(struct rev_info *revs)\n \t}\n \tfree(list);\n \n-\tif (revs->no_walk)\n+\tif (REV_TRAV_TST(revs, NO_WALK))\n \t\treturn 0;\n-\tif (revs->limited)\n+\tif (REV_TRAV_TST(revs, LIMITED))\n \t\tif (limit_list(revs) < 0)\n \t\t\treturn -1;\n-\tif (revs->topo_order)\n-\t\tsort_in_topological_order(&revs->commits, revs->lifo);\n+\tif (REV_TRAV_TST(revs, TOPO_ORDER))\n+\t\tsort_in_topological_order(&revs->commits, REV_TRAV_TST(revs, LIFO));\n \tif (revs->children.name)\n \t\tset_children(revs);\n \treturn 0;\n@@ -1494,7 +1494,7 @@ static enum rewrite_result rewrite_one(struct rev_info *revs, struct commit **pp\n {\n \tfor (;;) {\n \t\tstruct commit *p = *pp;\n-\t\tif (!revs->limited)\n+\t\tif (!REV_TRAV_TST(revs, LIMITED))\n \t\t\tif (add_parents_to_list(revs, p, &revs->commits) < 0)\n \t\t\t\treturn rewrite_one_error;\n \t\tif (p->parents && p->parents->next)\n@@ -1560,26 +1560,26 @@ static int commit_match(struct commit *commit, struct rev_info *opt)\n \n static inline int want_ancestry(struct rev_info *revs)\n {\n-\treturn (revs->rewrite_parents || revs->children.name);\n+\treturn (REV_TRAV_TST(revs, REWRITE_PARENTS) || revs->children.name);\n }\n \n enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit)\n {\n \tif (commit->object.flags & SHOWN)\n \t\treturn commit_ignore;\n-\tif (revs->unpacked && has_sha1_pack(commit->object.sha1, revs->ignore_packed))\n+\tif (REV_TRAV_TST(revs, UNPACKED) && has_sha1_pack(commit->object.sha1, revs->ignore_packed))\n \t\treturn commit_ignore;\n-\tif (revs->show_all)\n+\tif (REV_TRAV_TST(revs, SHOW_ALL))\n \t\treturn commit_show;\n \tif (commit->object.flags & UNINTERESTING)\n \t\treturn commit_ignore;\n \tif (revs->min_age != -1 && (commit->date > revs->min_age))\n \t\treturn commit_ignore;\n-\tif (revs->no_merges && commit->parents && commit->parents->next)\n+\tif (REV_TRAV_TST(revs, NO_MERGES) && commit->parents && commit->parents->next)\n \t\treturn commit_ignore;\n \tif (!commit_match(commit, revs))\n \t\treturn commit_ignore;\n-\tif (revs->prune && revs->dense) {\n+\tif (REV_TRAV_TST(revs, PRUNE) && REV_TRAV_TST(revs, DENSE)) {\n \t\t/* Commit without changes? */\n \t\tif (commit->object.flags & TREESAME) {\n \t\t\t/* drop merges unless we want parenthood */\n@@ -1615,7 +1615,7 @@ static struct commit *get_revision_1(struct rev_info *revs)\n \t\t * the parents here. We also need to do the date-based limiting\n \t\t * that we'd otherwise have done in limit_list().\n \t\t */\n-\t\tif (!revs->limited) {\n+\t\tif (!REV_TRAV_TST(revs, LIMITED)) {\n \t\t\tif (revs->max_age != -1 &&\n \t\t\t    (commit->date < revs->max_age))\n \t\t\t\tcontinue;\n@@ -1694,7 +1694,7 @@ static void create_boundary_commit_list(struct rev_info *revs)\n \t * If revs->topo_order is set, sort the boundary commits\n \t * in topological order\n \t */\n-\tsort_in_topological_order(&revs->commits, revs->lifo);\n+\tsort_in_topological_order(&revs->commits, REV_TRAV_TST(revs, LIFO));\n }\n \n static struct commit *get_revision_internal(struct rev_info *revs)\n@@ -1702,7 +1702,7 @@ static struct commit *get_revision_internal(struct rev_info *revs)\n \tstruct commit *c = NULL;\n \tstruct commit_list *l;\n \n-\tif (revs->boundary == 2) {\n+\tif (REV_TRAV_TST(revs, BOUNDARY_OUTPUT)) {\n \t\t/*\n \t\t * All of the normal commits have already been returned,\n \t\t * and we are now returning boundary commits.\n@@ -1715,7 +1715,7 @@ static struct commit *get_revision_internal(struct rev_info *revs)\n \t\treturn c;\n \t}\n \n-\tif (revs->reverse) {\n+\tif (REV_TRAV_TST(revs, REVERSE)) {\n \t\tint limit = -1;\n \n \t\tif (0 <= revs->max_count) {\n@@ -1730,7 +1730,7 @@ static struct commit *get_revision_internal(struct rev_info *revs)\n \t\t\t\tbreak;\n \t\t}\n \t\trevs->commits = l;\n-\t\trevs->reverse = 0;\n+\t\tREV_TRAV_CLR(revs, REVERSE);\n \t\trevs->max_count = -1;\n \t\tc = NULL;\n \t}\n@@ -1764,7 +1764,7 @@ static struct commit *get_revision_internal(struct rev_info *revs)\n \tif (c)\n \t\tc->object.flags |= SHOWN;\n \n-\tif (!revs->boundary) {\n+\tif (!REV_TRAV_TST(revs, BOUNDARY)) {\n \t\treturn c;\n \t}\n \n@@ -1774,7 +1774,7 @@ static struct commit *get_revision_internal(struct rev_info *revs)\n \t\t * we are done computing the boundaries.\n \t\t * switch to boundary commits output mode.\n \t\t */\n-\t\trevs->boundary = 2;\n+\t\tREV_TRAV_SET(revs, BOUNDARY_OUTPUT);\n \n \t\t/*\n \t\t * Update revs->commits to contain the list of\ndiff --git a/revision.h b/revision.h\nindex 72ab144..5c95b9b 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -15,6 +15,57 @@\n struct rev_info;\n struct log_info;\n \n+/* rev_info traversal flags */\n+#define REV_TRAV_DENSE               (1u <<  0)\n+#define REV_TRAV_PRUNE               (1u <<  1)\n+#define REV_TRAV_NO_MERGES           (1u <<  2)\n+#define REV_TRAV_NO_WALK             (1u <<  3)\n+#define REV_TRAV_SHOW_ALL            (1u <<  4)\n+#define REV_TRAV_REMOVE_EMPTY_TREES  (1u <<  5)\n+#define REV_TRAV_SIMPLIFY_HISTORY    (1u <<  6)\n+#define REV_TRAV_LIFO                (1u <<  7)\n+#define REV_TRAV_TOPO_ORDER          (1u <<  8)\n+#define REV_TRAV_TAG_OBJECTS         (1u <<  9)\n+#define REV_TRAV_TREE_OBJECTS        (1u << 10)\n+#define REV_TRAV_BLOB_OBJECTS        (1u << 11)\n+#define REV_TRAV_EDGE_HINT           (1u << 12)\n+#define REV_TRAV_LIMITED             (1u << 13)\n+#define REV_TRAV_UNPACKED            (1u << 14)\n+#define REV_TRAV_BOUNDARY            (1u << 15)\n+#define REV_TRAV_BOUNDARY_OUTPUT     (1u << 16)\n+#define REV_TRAV_LEFT_RIGHT          (1u << 17)\n+#define REV_TRAV_REWRITE_PARENTS     (1u << 18)\n+#define REV_TRAV_PRINT_PARENTS       (1u << 19)\n+#define REV_TRAV_REVERSE             (1u << 20)\n+#define REV_TRAV_CHERRY_PICK         (1u << 21)\n+#define REV_TRAV_FIRST_PARENT_ONLY   (1u << 22)\n+#define REV_TRAV_TST(rev, flag)      ((rev)->trav_flags & REV_TRAV_##flag)\n+#define REV_TRAV_SET(rev, flag)      ((rev)->trav_flags |= REV_TRAV_##flag)\n+#define REV_TRAV_XOR(rev, flag)      ((rev)->trav_flags ^= REV_TRAV_##flag)\n+#define REV_TRAV_CLR(rev, flag)      ((rev)->trav_flags &= ~REV_TRAV_##flag)\n+\n+#define REV_DIFF_DIFF                   (1u << 0)\n+#define REV_DIFF_FULL_DIFF              (1u << 1)\n+#define REV_DIFF_SHOW_ROOT_DIFF         (1u << 2)\n+#define REV_DIFF_NO_COMMIT_ID           (1u << 3)\n+#define REV_DIFF_VERBOSE_HEADER         (1u << 4)\n+#define REV_DIFF_IGNORE_MERGES          (1u << 5)\n+#define REV_DIFF_COMBINE_MERGES         (1u << 6)\n+#define REV_DIFF_DENSE_COMBINED_MERGES  (1u << 7)\n+#define REV_DIFF_ALWAYS_SHOW_HEADER     (1u << 8)\n+#define REV_DIFF_TST(rev, flag)      ((rev)->diff_flags & REV_DIFF_##flag)\n+#define REV_DIFF_SET(rev, flag)      ((rev)->diff_flags |= REV_DIFF_##flag)\n+#define REV_DIFF_CLR(rev, flag)      ((rev)->diff_flags &= ~REV_DIFF_##flag)\n+\n+#define REV_FMT_SHOWN_ONE               (1u << 0)\n+#define REV_FMT_SHOW_MERGE              (1u << 1)\n+#define REV_FMT_ABBREV_COMMIT           (1u << 2)\n+#define REV_FMT_USE_TERMINATOR          (1u << 3)\n+#define REV_FMT_MISSING_NEWLINE         (1u << 4)\n+#define REV_FMT_TST(rev, flag)       ((rev)->fmt_flags & REV_FMT_##flag)\n+#define REV_FMT_SET(rev, flag)       ((rev)->fmt_flags |= REV_FMT_##flag)\n+#define REV_FMT_CLR(rev, flag)       ((rev)->fmt_flags &= ~REV_FMT_##flag)\n+\n struct rev_info {\n \t/* Starting list */\n \tstruct commit_list *commits;\n@@ -29,47 +80,9 @@ struct rev_info {\n \tvoid *prune_data;\n \tunsigned int early_output;\n \n-\t/* Traversal flags */\n-\tunsigned int\tdense:1,\n-\t\t\tprune:1,\n-\t\t\tno_merges:1,\n-\t\t\tno_walk:1,\n-\t\t\tshow_all:1,\n-\t\t\tremove_empty_trees:1,\n-\t\t\tsimplify_history:1,\n-\t\t\tlifo:1,\n-\t\t\ttopo_order:1,\n-\t\t\ttag_objects:1,\n-\t\t\ttree_objects:1,\n-\t\t\tblob_objects:1,\n-\t\t\tedge_hint:1,\n-\t\t\tlimited:1,\n-\t\t\tunpacked:1, /* see also ignore_packed below */\n-\t\t\tboundary:2,\n-\t\t\tleft_right:1,\n-\t\t\trewrite_parents:1,\n-\t\t\tprint_parents:1,\n-\t\t\treverse:1,\n-\t\t\tcherry_pick:1,\n-\t\t\tfirst_parent_only:1;\n-\n-\t/* Diff flags */\n-\tunsigned int\tdiff:1,\n-\t\t\tfull_diff:1,\n-\t\t\tshow_root_diff:1,\n-\t\t\tno_commit_id:1,\n-\t\t\tverbose_header:1,\n-\t\t\tignore_merges:1,\n-\t\t\tcombine_merges:1,\n-\t\t\tdense_combined_merges:1,\n-\t\t\talways_show_header:1;\n-\n-\t/* Format info */\n-\tunsigned int\tshown_one:1,\n-\t\t\tshow_merge:1,\n-\t\t\tuse_terminator:1,\n-\t\t\tabbrev_commit:1,\n-\t\t\tmissing_newline:1;\n+\tunsigned int trav_flags; /* Traversal flags */\n+\tunsigned int diff_flags; /* Diff flags */\n+\tunsigned int fmt_flags;  /* Format info */\n \tenum date_mode date_mode;\n \n \tconst char **ignore_packed; /* pretend objects in these are unpacked */\ndiff --git a/upload-pack.c b/upload-pack.c\nindex 9d031fc..5845488 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -108,11 +108,11 @@ static int do_rev_list(int fd, void *create_full_pack)\n \tif (create_full_pack)\n \t\tuse_thin_pack = 0; /* no point doing it */\n \tinit_revisions(&revs, NULL);\n-\trevs.tag_objects = 1;\n-\trevs.tree_objects = 1;\n-\trevs.blob_objects = 1;\n+\tREV_TRAV_SET(revs, TAG_OBJECTS);\n+\tREV_TRAV_SET(revs, BLOB_OBJECTS);\n+\tREV_TRAV_SET(revs, TREE_OBJECTS);\n \tif (use_thin_pack)\n-\t\trevs.edge_hint = 1;\n+\t\tREV_TRAV_SET(&revs, EDGE_HINT);\n \n \tif (create_full_pack) {\n \t\tconst char *args[] = {\"rev-list\", \"--all\", NULL};\n-- \n1.5.6.rc0.145.ge0aba\n"},{"id":"77956","messageId":"1211994985-25317-1-git-send-email-madcoder@debian.org","threadId":"13699","inReplyTo":"1211966245-18393-2-git-send-email-madcoder@debian.org","subject":"[RESEND SMALL FIX] revisions: move traversal bit-fields to masks.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2008-05-28T17:16:25Z","receivedAt":"2008-05-28T17:16:25Z","isPatch":false,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"Signed-off-by: Pierre Habouzit <madcoder@debian.org>\n---\n\n  For some reason my previous patch was borked, probably because of a sloppy rebase :/\n  Please consider that one instead.\n\n builtin-commit.c        |    8 +-\n builtin-diff-files.c    |    6 +-\n builtin-diff-tree.c     |    2 +-\n builtin-diff.c          |   14 ++-\n builtin-fmt-merge-msg.c |    6 +-\n builtin-log.c           |   64 ++++++++-------\n builtin-rev-list.c      |   25 +++---\n combine-diff.c          |    8 +-\n diff-lib.c              |   10 +-\n graph.c                 |   10 ++-\n list-objects.c          |    6 +-\n log-tree.c              |   42 +++++-----\n pretty.c                |    6 +-\n reachable.c             |    6 +-\n revision.c              |  202 +++++++++++++++++++++++-----------------------\n revision.h              |   95 +++++++++++++----------\n upload-pack.c           |    8 +-\n 17 files changed, 272 insertions(+), 246 deletions(-)\n\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex 59b3dc2..4fc7eaa 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -837,14 +837,14 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n \tsetup_revisions(&rev, NULL);\n \n \trev.abbrev = 0;\n-\trev.diff = 1;\n+\tREV_DIFF_SET(&rev, DIFF);\n+\tREV_DIFF_SET(&rev, VERBOSE_HEADER);\n+\tREV_DIFF_SET(&rev, SHOW_ROOT_DIFF);\n \trev.diffopt.output_format =\n \t\tDIFF_FORMAT_SHORTSTAT | DIFF_FORMAT_SUMMARY;\n \n-\trev.verbose_header = 1;\n-\trev.show_root_diff = 1;\n \tget_commit_format(\"format:%h: %s\", &rev);\n-\trev.always_show_header = 0;\n+\tREV_DIFF_CLR(&rev, ALWAYS_SHOW_HEADER);\n \trev.diffopt.detect_rename = 1;\n \trev.diffopt.rename_limit = 100;\n \trev.diffopt.break_opt = 0;\ndiff --git a/builtin-diff-files.c b/builtin-diff-files.c\nindex e7e202a..cb7a318 100644\n--- a/builtin-diff-files.c\n+++ b/builtin-diff-files.c\n@@ -52,8 +52,10 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)\n \t\tusage(diff_files_usage);\n \n \tif (rev.max_count == -1 &&\n-\t    (rev.diffopt.output_format & DIFF_FORMAT_PATCH))\n-\t\trev.combine_merges = rev.dense_combined_merges = 1;\n+\t    (rev.diffopt.output_format & DIFF_FORMAT_PATCH)) {\n+\t\tREV_DIFF_SET(&rev, COMBINE_MERGES);\n+\t\tREV_DIFF_SET(&rev, DENSE_COMBINED_MERGES);\n+\t}\n \n \tif (read_cache() < 0) {\n \t\tperror(\"read_cache\");\ndiff --git a/builtin-diff-tree.c b/builtin-diff-tree.c\nindex 0900175..9a34a36 100644\n--- a/builtin-diff-tree.c\n+++ b/builtin-diff-tree.c\n@@ -71,7 +71,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)\n \tgit_config(git_diff_basic_config, NULL); /* no \"diff\" UI options */\n \tnr_sha1 = 0;\n \topt->abbrev = 0;\n-\topt->diff = 1;\n+\tREV_DIFF_SET(opt, DIFF);\n \targc = parse_revisions(argc, argv, opt);\n \tsetup_revisions(opt, NULL);\n \ndiff --git a/builtin-diff.c b/builtin-diff.c\nindex a92dbd4..acf50aa 100644\n--- a/builtin-diff.c\n+++ b/builtin-diff.c\n@@ -170,15 +170,17 @@ static int builtin_diff_combined(struct rev_info *revs,\n \tif (argc > 1)\n \t\tusage(builtin_diff_usage);\n \n-\tif (!revs->dense_combined_merges && !revs->combine_merges)\n-\t\trevs->dense_combined_merges = revs->combine_merges = 1;\n+\tif (!REV_DIFF_TST(revs, DENSE_COMBINED_MERGES) && !REV_DIFF_TST(revs, COMBINE_MERGES)) {\n+\t\tREV_DIFF_SET(revs, DENSE_COMBINED_MERGES);\n+\t\tREV_DIFF_SET(revs, COMBINE_MERGES);\n+\t}\n \tparent = xmalloc(ents * sizeof(*parent));\n \t/* Again, the revs are all reverse */\n \tfor (i = 0; i < ents; i++)\n \t\thashcpy((unsigned char *)(parent + i),\n \t\t\tent[ents - 1 - i].item->sha1);\n \tdiff_tree_combined(parent[0], parent + 1, ents - 1,\n-\t\t\t   revs->dense_combined_merges, revs);\n+\t\t\t   REV_DIFF_TST(revs, DENSE_COMBINED_MERGES), revs);\n \treturn 0;\n }\n \n@@ -222,8 +224,10 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv\n \t}\n \n \tif (revs->max_count == -1 &&\n-\t    (revs->diffopt.output_format & DIFF_FORMAT_PATCH))\n-\t\trevs->combine_merges = revs->dense_combined_merges = 1;\n+\t    (revs->diffopt.output_format & DIFF_FORMAT_PATCH)) {\n+\t\tREV_DIFF_SET(revs, COMBINE_MERGES);\n+\t\tREV_DIFF_SET(revs, DENSE_COMBINED_MERGES);\n+\t}\n \n \tif (read_cache() < 0) {\n \t\tperror(\"read_cache\");\ndiff --git a/builtin-fmt-merge-msg.c b/builtin-fmt-merge-msg.c\nindex dad81b8..29a1cfe 100644\n--- a/builtin-fmt-merge-msg.c\n+++ b/builtin-fmt-merge-msg.c\n@@ -188,7 +188,7 @@ static void shortlog(const char *name, unsigned char *sha1,\n \t\treturn;\n \n \tsetup_revisions(rev, NULL);\n-\trev->ignore_merges = 1;\n+\tREV_DIFF_SET(rev, IGNORE_MERGES);\n \tadd_pending_object(rev, branch, name);\n \tadd_pending_object(rev, &head->object, \"^HEAD\");\n \thead->object.flags |= UNINTERESTING;\n@@ -355,8 +355,8 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n \t\thead = lookup_commit(head_sha1);\n \t\tinit_revisions(&rev, prefix);\n \t\trev.commit_format = CMIT_FMT_ONELINE;\n-\t\trev.ignore_merges = 1;\n-\t\trev.limited = 1;\n+\t\tREV_DIFF_SET(&rev, IGNORE_MERGES);\n+\t\tREV_TRAV_SET(&rev, LIMITED);\n \n \t\tfor (i = 0; i < origins.nr; i++)\n \t\t\tshortlog(origins.list[i], origins.payload[i],\ndiff --git a/builtin-log.c b/builtin-log.c\nindex dde7192..be8f5b9 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -60,9 +60,13 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,\n \trev->commit_format = CMIT_FMT_DEFAULT;\n \tif (fmt_pretty)\n \t\tget_commit_format(fmt_pretty, rev);\n-\trev->verbose_header = 1;\n \tDIFF_OPT_SET(&rev->diffopt, RECURSIVE);\n-\trev->show_root_diff = default_show_root;\n+\tREV_DIFF_SET(rev, VERBOSE_HEADER);\n+\tif (default_show_root) {\n+\t\tREV_DIFF_SET(rev, SHOW_ROOT_DIFF);\n+\t} else {\n+\t\tREV_DIFF_CLR(rev, SHOW_ROOT_DIFF);\n+\t}\n \trev->subject_prefix = fmt_patch_subject_prefix;\n \n \tif (default_date_mode)\n@@ -71,9 +75,9 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,\n \targc = parse_revisions(argc, argv, rev);\n \tsetup_revisions(rev, \"HEAD\");\n \tif (rev->diffopt.pickaxe || rev->diffopt.filter)\n-\t\trev->always_show_header = 0;\n+\t\tREV_DIFF_CLR(rev, ALWAYS_SHOW_HEADER);\n \tif (DIFF_OPT_TST(&rev->diffopt, FOLLOW_RENAMES)) {\n-\t\trev->always_show_header = 0;\n+\t\tREV_DIFF_CLR(rev, ALWAYS_SHOW_HEADER);\n \t\tif (rev->diffopt.nr_paths != 1)\n \t\t\tusage(\"git logs can only follow renames on one pathname at a time\");\n \t}\n@@ -108,8 +112,8 @@ static int estimate_commit_count(struct rev_info *rev, struct commit_list *list)\n \n static void show_early_header(struct rev_info *rev, const char *stage, int nr)\n {\n-\tif (rev->shown_one) {\n-\t\trev->shown_one = 0;\n+\tif (REV_FMT_TST(rev, SHOWN_ONE)) {\n+\t\tREV_FMT_CLR(rev, SHOWN_ONE);\n \t\tif (rev->commit_format != CMIT_FMT_ONELINE)\n \t\t\tputchar(rev->diffopt.line_termination);\n \t}\n@@ -123,7 +127,7 @@ static void log_show_early(struct rev_info *revs, struct commit_list *list)\n \tint i = revs->early_output;\n \tint show_header = 1;\n \n-\tsort_in_topological_order(&list, revs->lifo);\n+\tsort_in_topological_order(&list, REV_TRAV_TST(revs, LIFO));\n \twhile (list && i) {\n \t\tstruct commit *commit = list->item;\n \t\tswitch (simplify_commit(revs, commit)) {\n@@ -259,8 +263,8 @@ int cmd_whatchanged(int argc, const char **argv, const char *prefix)\n \t\tdiff_use_color_default = git_use_color_default;\n \n \tinit_revisions(&rev, prefix);\n-\trev.diff = 1;\n-\trev.simplify_history = 0;\n+\tREV_DIFF_SET(&rev, DIFF);\n+\tREV_TRAV_CLR(&rev, SIMPLIFY_HISTORY);\n \tcmd_log_init(argc, argv, prefix, &rev);\n \tif (!rev.diffopt.output_format)\n \t\trev.diffopt.output_format = DIFF_FORMAT_RAW;\n@@ -335,12 +339,12 @@ int cmd_show(int argc, const char **argv, const char *prefix)\n \t\tdiff_use_color_default = git_use_color_default;\n \n \tinit_revisions(&rev, prefix);\n-\trev.diff = 1;\n-\trev.combine_merges = 1;\n-\trev.dense_combined_merges = 1;\n-\trev.always_show_header = 1;\n-\trev.ignore_merges = 0;\n-\trev.no_walk = 1;\n+\tREV_DIFF_SET(&rev, DIFF);\n+\tREV_DIFF_SET(&rev, COMBINE_MERGES);\n+\tREV_DIFF_SET(&rev, DENSE_COMBINED_MERGES);\n+\tREV_DIFF_SET(&rev, ALWAYS_SHOW_HEADER);\n+\tREV_DIFF_CLR(&rev, IGNORE_MERGES);\n+\tREV_TRAV_SET(&rev, NO_WALK);\n \tcmd_log_init(argc, argv, prefix, &rev);\n \n \tcount = rev.pending.nr;\n@@ -400,8 +404,8 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)\n \n \tinit_revisions(&rev, prefix);\n \tinit_reflog_walk(&rev.reflog_info);\n-\trev.abbrev_commit = 1;\n-\trev.verbose_header = 1;\n+\tREV_FMT_SET(&rev, ABBREV_COMMIT);\n+\tREV_DIFF_SET(&rev, VERBOSE_HEADER);\n \tcmd_log_init(argc, argv, prefix, &rev);\n \n \t/*\n@@ -410,8 +414,8 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)\n \t * allow us to set a different default.\n \t */\n \trev.commit_format = CMIT_FMT_ONELINE;\n-\trev.use_terminator = 1;\n-\trev.always_show_header = 1;\n+\tREV_FMT_SET(&rev, USE_TERMINATOR);\n+\tREV_DIFF_SET(&rev, ALWAYS_SHOW_HEADER);\n \n \t/*\n \t * We get called through \"git reflog\", so unlike the other log\n@@ -432,7 +436,7 @@ int cmd_log(int argc, const char **argv, const char *prefix)\n \t\tdiff_use_color_default = git_use_color_default;\n \n \tinit_revisions(&rev, prefix);\n-\trev.always_show_header = 1;\n+\tREV_DIFF_SET(&rev, ALWAYS_SHOW_HEADER);\n \tcmd_log_init(argc, argv, prefix, &rev);\n \treturn cmd_log_walk(&rev);\n }\n@@ -784,10 +788,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \tgit_config(git_format_config, NULL);\n \tinit_revisions(&rev, prefix);\n \trev.commit_format = CMIT_FMT_EMAIL;\n-\trev.verbose_header = 1;\n-\trev.diff = 1;\n-\trev.combine_merges = 0;\n-\trev.ignore_merges = 1;\n+\tREV_DIFF_SET(&rev, VERBOSE_HEADER);\n+\tREV_DIFF_SET(&rev, DIFF);\n+\tREV_DIFF_CLR(&rev, COMBINE_MERGES);\n+\tREV_DIFF_SET(&rev, IGNORE_MERGES);\n \tDIFF_OPT_SET(&rev.diffopt, RECURSIVE);\n \n \trev.subject_prefix = fmt_patch_subject_prefix;\n@@ -950,7 +954,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \t}\n \n \tif (rev.pending.nr == 1) {\n-\t\tif (rev.max_count < 0 && !rev.show_root_diff) {\n+\t\tif (rev.max_count < 0 && !REV_DIFF_TST(&rev, SHOW_ROOT_DIFF)) {\n \t\t\t/*\n \t\t\t * This is traditional behaviour of \"git format-patch\n \t\t\t * origin\" that prepares what the origin side still\n@@ -986,7 +990,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \n \tif (prepare_revision_walk(&rev))\n \t\tdie(\"revision walk setup failed\");\n-\trev.boundary = 1;\n+\tREV_TRAV_SET(&rev, BOUNDARY);\n \twhile ((commit = get_revision(&rev)) != NULL) {\n \t\tif (commit->object.flags & BOUNDARY) {\n \t\t\tboundary_count++;\n@@ -1058,7 +1062,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \t\t * not want the extra blank line.\n \t\t */\n \t\tif (!use_stdout)\n-\t\t\trev.shown_one = 0;\n+\t\t\tREV_FMT_CLR(&rev, SHOWN_ONE);\n \t\tif (shown) {\n \t\t\tif (rev.mime_boundary)\n \t\t\t\tprintf(\"\\n--%s%s--\\n\\n\\n\",\n@@ -1124,9 +1128,9 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)\n \t}\n \n \tinit_revisions(&revs, prefix);\n-\trevs.diff = 1;\n-\trevs.combine_merges = 0;\n-\trevs.ignore_merges = 1;\n+\tREV_DIFF_SET(&revs, DIFF);\n+\tREV_DIFF_CLR(&revs, COMBINE_MERGES);\n+\tREV_DIFF_SET(&revs, IGNORE_MERGES);\n \tDIFF_OPT_SET(&revs.diffopt, RECURSIVE);\n \n \tif (add_pending_commit(head, &revs, 0))\ndiff --git a/builtin-rev-list.c b/builtin-rev-list.c\nindex ed60227..db61872 100644\n--- a/builtin-rev-list.c\n+++ b/builtin-rev-list.c\n@@ -72,19 +72,19 @@ static void show_commit(struct commit *commit)\n \t\t\tputchar('-');\n \t\telse if (commit->object.flags & UNINTERESTING)\n \t\t\tputchar('^');\n-\t\telse if (revs.left_right) {\n+\t\telse if (REV_TRAV_TST(&revs, LEFT_RIGHT)) {\n \t\t\tif (commit->object.flags & SYMMETRIC_LEFT)\n \t\t\t\tputchar('<');\n \t\t\telse\n \t\t\t\tputchar('>');\n \t\t}\n \t}\n-\tif (revs.abbrev_commit && revs.abbrev)\n+\tif (REV_FMT_TST(&revs, ABBREV_COMMIT) && revs.abbrev)\n \t\tfputs(find_unique_abbrev(commit->object.sha1, revs.abbrev),\n \t\t      stdout);\n \telse\n \t\tfputs(sha1_to_hex(commit->object.sha1), stdout);\n-\tif (revs.print_parents) {\n+\tif (REV_TRAV_TST(&revs, PRINT_PARENTS)) {\n \t\tstruct commit_list *parents = commit->parents;\n \t\twhile (parents) {\n \t\t\tprintf(\" %s\", sha1_to_hex(parents->item->object.sha1));\n@@ -106,7 +106,7 @@ static void show_commit(struct commit *commit)\n \telse\n \t\tputchar('\\n');\n \n-\tif (revs.verbose_header && commit->buffer) {\n+\tif (REV_DIFF_TST(&revs, VERBOSE_HEADER) && commit->buffer) {\n \t\tstruct strbuf buf;\n \t\tstrbuf_init(&buf, 0);\n \t\tpretty_print_commit(revs.commit_format, commit,\n@@ -612,7 +612,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n \t\tconst char *arg = argv[i];\n \n \t\tif (!strcmp(arg, \"--header\")) {\n-\t\t\trevs.verbose_header = 1;\n+\t\t\tREV_DIFF_SET(&revs, VERBOSE_HEADER);\n \t\t\tcontinue;\n \t\t}\n \t\tif (!strcmp(arg, \"--timestamp\")) {\n@@ -654,25 +654,26 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n \t\telse\n \t\t\theader_prefix = \"commit \";\n \t}\n-\telse if (revs.verbose_header)\n+\telse if (REV_DIFF_TST(&revs, VERBOSE_HEADER))\n \t\t/* Only --header was specified */\n \t\trevs.commit_format = CMIT_FMT_RAW;\n \n \tlist = revs.commits;\n \n \tif ((!list &&\n-\t     (!(revs.tag_objects||revs.tree_objects||revs.blob_objects) &&\n-\t      !revs.pending.nr)) ||\n-\t    revs.diff)\n+\t\t (!(REV_TRAV_TST(&revs, TAG_OBJECTS) ||\n+\t\t\tREV_TRAV_TST(&revs, TREE_OBJECTS) ||\n+\t\t\tREV_TRAV_TST(&revs, BLOB_OBJECTS)) &&\n+\t      !revs.pending.nr)) || REV_DIFF_TST(&revs, DIFF))\n \t\tusage(rev_list_usage);\n \n-\tsave_commit_buffer = revs.verbose_header || revs.grep_filter;\n+\tsave_commit_buffer = REV_DIFF_TST(&revs, VERBOSE_HEADER) || revs.grep_filter;\n \tif (bisect_list)\n-\t\trevs.limited = 1;\n+\t\tREV_TRAV_SET(&revs, LIMITED);\n \n \tif (prepare_revision_walk(&revs))\n \t\tdie(\"revision walk setup failed\");\n-\tif (revs.tree_objects)\n+\tif (REV_TRAV_TST(&revs, TREE_OBJECTS))\n \t\tmark_edges_uninteresting(revs.commits, &revs, show_edge);\n \n \tif (bisect_list) {\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 588c58b..9b32bcf 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -796,7 +796,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,\n \t\tint added = 0;\n \t\tint deleted = 0;\n \n-\t\tif (rev->loginfo && !rev->no_commit_id)\n+\t\tif (rev->loginfo && !REV_DIFF_TST(rev, NO_COMMIT_ID))\n \t\t\tshow_log(rev);\n \t\tdump_quoted_path(dense ? \"diff --cc \" : \"diff --combined \",\n \t\t\t\t \"\", elem->path, c_meta, c_reset);\n@@ -879,7 +879,7 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re\n \tif (!line_termination)\n \t\tinter_name_termination = 0;\n \n-\tif (rev->loginfo && !rev->no_commit_id)\n+\tif (rev->loginfo && !REV_DIFF_TST(rev, NO_COMMIT_ID))\n \t\tshow_log(rev);\n \n \tif (opt->output_format & DIFF_FORMAT_RAW) {\n@@ -943,7 +943,7 @@ void diff_tree_combined(const unsigned char *sha1,\n \tDIFF_OPT_SET(&diffopts, RECURSIVE);\n \tDIFF_OPT_CLR(&diffopts, ALLOW_EXTERNAL);\n \n-\tshow_log_first = !!rev->loginfo && !rev->no_commit_id;\n+\tshow_log_first = !!rev->loginfo && !REV_DIFF_TST(rev, NO_COMMIT_ID);\n \tneedsep = 0;\n \t/* find set of paths that everybody touches */\n \tfor (i = 0; i < num_parent; i++) {\n@@ -962,7 +962,7 @@ void diff_tree_combined(const unsigned char *sha1,\n \n \t\tif (show_log_first && i == 0) {\n \t\t\tshow_log(rev);\n-\t\t\tif (rev->verbose_header && opt->output_format)\n+\t\t\tif (REV_DIFF_TST(rev, VERBOSE_HEADER) && opt->output_format)\n \t\t\t\tputchar(opt->line_termination);\n \t\t}\n \t\tdiff_flush(&diffopts);\ndiff --git a/diff-lib.c b/diff-lib.c\nindex b17722d..777b98f 100644\n--- a/diff-lib.c\n+++ b/diff-lib.c\n@@ -140,9 +140,9 @@ int run_diff_files(struct rev_info *revs, unsigned int option)\n \t\t\t */\n \t\t\ti--;\n \n-\t\t\tif (revs->combine_merges && num_compare_stages == 2) {\n+\t\t\tif (REV_DIFF_TST(revs, COMBINE_MERGES) && num_compare_stages == 2) {\n \t\t\t\tshow_combined_diff(dpath, 2,\n-\t\t\t\t\t\t   revs->dense_combined_merges,\n+\t\t\t\t\t\t   REV_DIFF_TST(revs, DENSE_COMBINED_MERGES),\n \t\t\t\t\t\t   revs);\n \t\t\t\tfree(dpath);\n \t\t\t\tcontinue;\n@@ -281,7 +281,7 @@ static int show_modified(struct oneway_unpack_data *cbdata,\n \t\treturn -1;\n \t}\n \n-\tif (revs->combine_merges && !cached &&\n+\tif (REV_DIFF_TST(revs, COMBINE_MERGES) && !cached &&\n \t    (hashcmp(sha1, old->sha1) || hashcmp(old->sha1, new->sha1))) {\n \t\tstruct combine_diff_path *p;\n \t\tint pathlen = ce_namelen(new);\n@@ -301,7 +301,7 @@ static int show_modified(struct oneway_unpack_data *cbdata,\n \t\tp->parent[1].status = DIFF_STATUS_MODIFIED;\n \t\tp->parent[1].mode = old->ce_mode;\n \t\thashcpy(p->parent[1].sha1, old->sha1);\n-\t\tshow_combined_diff(p, 2, revs->dense_combined_merges, revs);\n+\t\tshow_combined_diff(p, 2, REV_DIFF_TST(revs, DENSE_COMBINED_MERGES), revs);\n \t\tfree(p);\n \t\treturn 0;\n \t}\n@@ -354,7 +354,7 @@ static void do_oneway_diff(struct unpack_trees_options *o,\n \t * \"!revs->ignore_merges\".\n \t */\n \tcached = o->index_only;\n-\tmatch_missing = !revs->ignore_merges;\n+\tmatch_missing = !REV_DIFF_TST(revs, IGNORE_MERGES);\n \n \tif (cached && idx && ce_stage(idx)) {\n \t\tif (tree)\ndiff --git a/graph.c b/graph.c\nindex 26b8c52..1173440 100644\n--- a/graph.c\n+++ b/graph.c\n@@ -196,7 +196,8 @@ static int graph_is_interesting(struct git_graph *graph, struct commit *commit)\n \t * been shown are always interesting, even if they have the\n \t * UNINTERESTING or TREESAME flags set.\n \t */\n-\tif (graph->revs && graph->revs->boundary) {\n+\tif (graph->revs && (REV_TRAV_TST(graph->revs, BOUNDARY)\n+\t\t\t|| REV_TRAV_TST(graph->revs, BOUNDARY_OUTPUT))) {\n \t\tif (commit->object.flags & CHILD_SHOWN)\n \t\t\treturn 1;\n \t}\n@@ -557,10 +558,11 @@ static void graph_output_commit_char(struct git_graph *graph, struct strbuf *sb)\n {\n \t/*\n \t * For boundary commits, print 'o'\n-\t * (We should only see boundary commits when revs->boundary is set.)\n+\t * (We should only see boundary commits when BOUNDARY/BOUNDARY_OUTPUT is set.)\n \t */\n \tif (graph->commit->object.flags & BOUNDARY) {\n-\t\tassert(graph->revs->boundary);\n+\t\tassert (REV_TRAV_TST(graph->revs, BOUNDARY)\n+\t\t\t\t|| REV_TRAV_TST(graph->revs, BOUNDARY_OUTPUT));\n \t\tstrbuf_addch(sb, 'o');\n \t\treturn;\n \t}\n@@ -570,7 +572,7 @@ static void graph_output_commit_char(struct git_graph *graph, struct strbuf *sb)\n \t * come from the left side, and '>' for commits from the right\n \t * side.\n \t */\n-\tif (graph->revs && graph->revs->left_right) {\n+\tif (graph->revs && REV_TRAV_TST(graph->revs, LEFT_RIGHT)) {\n \t\tif (graph->commit->object.flags & SYMMETRIC_LEFT)\n \t\t\tstrbuf_addch(sb, '<');\n \t\telse\ndiff --git a/list-objects.c b/list-objects.c\nindex c8b8375..b15af12 100644\n--- a/list-objects.c\n+++ b/list-objects.c\n@@ -16,7 +16,7 @@ static void process_blob(struct rev_info *revs,\n {\n \tstruct object *obj = &blob->object;\n \n-\tif (!revs->blob_objects)\n+\tif (!REV_TRAV_TST(revs, BLOB_OBJECTS))\n \t\treturn;\n \tif (!obj)\n \t\tdie(\"bad blob object\");\n@@ -69,7 +69,7 @@ static void process_tree(struct rev_info *revs,\n \tstruct name_entry entry;\n \tstruct name_path me;\n \n-\tif (!revs->tree_objects)\n+\tif (!REV_TRAV_TST(revs, TREE_OBJECTS))\n \t\treturn;\n \tif (!obj)\n \t\tdie(\"bad tree object\");\n@@ -114,7 +114,7 @@ static void mark_edge_parents_uninteresting(struct commit *commit,\n \t\tif (!(parent->object.flags & UNINTERESTING))\n \t\t\tcontinue;\n \t\tmark_tree_uninteresting(parent->tree);\n-\t\tif (revs->edge_hint && !(parent->object.flags & SHOWN)) {\n+\t\tif (REV_TRAV_TST(revs, EDGE_HINT) && !(parent->object.flags & SHOWN)) {\n \t\t\tparent->object.flags |= SHOWN;\n \t\t\tshow_edge(parent);\n \t\t}\ndiff --git a/log-tree.c b/log-tree.c\nindex 5505606..e2ee3ec 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -220,12 +220,12 @@ void show_log(struct rev_info *opt)\n \tstruct log_info *log = opt->loginfo;\n \tstruct commit *commit = log->commit, *parent = log->parent;\n \tint abbrev = opt->diffopt.abbrev;\n-\tint abbrev_commit = opt->abbrev_commit ? opt->abbrev : 40;\n+\tint abbrev_commit = REV_FMT_TST(opt, ABBREV_COMMIT) ? opt->abbrev : 40;\n \tconst char *subject = NULL, *extra_headers = opt->extra_headers;\n \tint need_8bit_cte = 0;\n \n \topt->loginfo = NULL;\n-\tif (!opt->verbose_header) {\n+\tif (!REV_DIFF_TST(opt, VERBOSE_HEADER)) {\n \t\tgraph_show_commit(opt->graph);\n \n \t\tif (!opt->graph) {\n@@ -233,7 +233,7 @@ void show_log(struct rev_info *opt)\n \t\t\t\tputchar('-');\n \t\t\telse if (commit->object.flags & UNINTERESTING)\n \t\t\t\tputchar('^');\n-\t\t\telse if (opt->left_right) {\n+\t\t\telse if (REV_TRAV_TST(opt, LEFT_RIGHT)) {\n \t\t\t\tif (commit->object.flags & SYMMETRIC_LEFT)\n \t\t\t\t\tputchar('<');\n \t\t\t\telse\n@@ -241,7 +241,7 @@ void show_log(struct rev_info *opt)\n \t\t\t}\n \t\t}\n \t\tfputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);\n-\t\tif (opt->print_parents)\n+\t\tif (REV_TRAV_TST(opt, PRINT_PARENTS))\n \t\t\tshow_parents(commit, abbrev_commit);\n \t\tshow_decorations(commit);\n \t\tif (opt->graph && !graph_is_commit_finished(opt->graph)) {\n@@ -257,7 +257,7 @@ void show_log(struct rev_info *opt)\n \t * Otherwise, add a diffopt.line_termination character before all\n \t * entries but the first.  (IOW, as a separator between entries)\n \t */\n-\tif (opt->shown_one && !opt->use_terminator) {\n+\tif (REV_FMT_TST(opt, SHOWN_ONE) && !REV_FMT_TST(opt, USE_TERMINATOR)) {\n \t\t/*\n \t\t * If entries are separated by a newline, the output\n \t\t * should look human-readable.  If the last entry ended\n@@ -271,11 +271,11 @@ void show_log(struct rev_info *opt)\n \t\t * separator.\n \t\t */\n \t\tif (opt->diffopt.line_termination == '\\n' &&\n-\t\t    !opt->missing_newline)\n+\t\t\t!REV_FMT_TST(opt, MISSING_NEWLINE))\n \t\t\tgraph_show_padding(opt->graph);\n \t\tputchar(opt->diffopt.line_termination);\n \t}\n-\topt->shown_one = 1;\n+\tREV_FMT_SET(opt, SHOWN_ONE);\n \n \t/*\n \t * If the history graph was requested,\n@@ -301,7 +301,7 @@ void show_log(struct rev_info *opt)\n \t\t\t\tputchar('-');\n \t\t\telse if (commit->object.flags & UNINTERESTING)\n \t\t\t\tputchar('^');\n-\t\t\telse if (opt->left_right) {\n+\t\t\telse if (REV_TRAV_TST(opt, LEFT_RIGHT)) {\n \t\t\t\tif (commit->object.flags & SYMMETRIC_LEFT)\n \t\t\t\t\tputchar('<');\n \t\t\t\telse\n@@ -310,7 +310,7 @@ void show_log(struct rev_info *opt)\n \t\t}\n \t\tfputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit),\n \t\t      stdout);\n-\t\tif (opt->print_parents)\n+\t\tif (REV_TRAV_TST(opt, PRINT_PARENTS))\n \t\t\tshow_parents(commit, abbrev_commit);\n \t\tif (parent)\n \t\t\tprintf(\" (from %s)\",\n@@ -364,16 +364,16 @@ void show_log(struct rev_info *opt)\n \t * end in a newline (including if it is empty)\n \t */\n \tif (!msgbuf.len || msgbuf.buf[msgbuf.len - 1] != '\\n')\n-\t\topt->missing_newline = 1;\n+\t\tREV_FMT_SET(opt, MISSING_NEWLINE);\n \telse\n-\t\topt->missing_newline = 0;\n+\t\tREV_FMT_CLR(opt, MISSING_NEWLINE);\n \n \tif (opt->graph)\n \t\tgraph_show_commit_msg(opt->graph, &msgbuf);\n \telse\n \t\tfwrite(msgbuf.buf, sizeof(char), msgbuf.len, stdout);\n-\tif (opt->use_terminator) {\n-\t\tif (!opt->missing_newline)\n+\tif (REV_FMT_TST(opt, USE_TERMINATOR)) {\n+\t\tif (!REV_FMT_TST(opt, MISSING_NEWLINE))\n \t\t\tgraph_show_padding(opt->graph);\n \t\tputchar('\\n');\n \t}\n@@ -393,7 +393,7 @@ int log_tree_diff_flush(struct rev_info *opt)\n \t\treturn 0;\n \t}\n \n-\tif (opt->loginfo && !opt->no_commit_id) {\n+\tif (opt->loginfo && !REV_DIFF_TST(opt, NO_COMMIT_ID)) {\n \t\t/* When showing a verbose header (i.e. log message),\n \t\t * and not in --pretty=oneline format, we would want\n \t\t * an extra newline between the end of log and the\n@@ -401,7 +401,7 @@ int log_tree_diff_flush(struct rev_info *opt)\n \t\t */\n \t\tshow_log(opt);\n \t\tif ((opt->diffopt.output_format & ~DIFF_FORMAT_NO_OUTPUT) &&\n-\t\t    opt->verbose_header &&\n+\t\t    REV_DIFF_TST(opt, VERBOSE_HEADER) &&\n \t\t    opt->commit_format != CMIT_FMT_ONELINE) {\n \t\t\tint pch = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH;\n \t\t\tif ((pch & opt->diffopt.output_format) == pch)\n@@ -417,7 +417,7 @@ static int do_diff_combined(struct rev_info *opt, struct commit *commit)\n {\n \tunsigned const char *sha1 = commit->object.sha1;\n \n-\tdiff_tree_combined_merge(sha1, opt->dense_combined_merges, opt);\n+\tdiff_tree_combined_merge(sha1, REV_DIFF_TST(opt, DENSE_COMBINED_MERGES), opt);\n \treturn !opt->loginfo;\n }\n \n@@ -432,13 +432,13 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log\n \tstruct commit_list *parents;\n \tunsigned const char *sha1 = commit->object.sha1;\n \n-\tif (!opt->diff)\n+\tif (!REV_DIFF_TST(opt, DIFF))\n \t\treturn 0;\n \n \t/* Root commit? */\n \tparents = commit->parents;\n \tif (!parents) {\n-\t\tif (opt->show_root_diff) {\n+\t\tif (REV_DIFF_TST(opt, SHOW_ROOT_DIFF)) {\n \t\t\tdiff_root_tree_sha1(sha1, \"\", &opt->diffopt);\n \t\t\tlog_tree_diff_flush(opt);\n \t\t}\n@@ -447,9 +447,9 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log\n \n \t/* More than one parent? */\n \tif (parents && parents->next) {\n-\t\tif (opt->ignore_merges)\n+\t\tif (REV_DIFF_TST(opt, IGNORE_MERGES))\n \t\t\treturn 0;\n-\t\telse if (opt->combine_merges)\n+\t\telse if (REV_DIFF_TST(opt, COMBINE_MERGES))\n \t\t\treturn do_diff_combined(opt, commit);\n \n \t\t/* If we show individual diffs, show the parent info */\n@@ -485,7 +485,7 @@ int log_tree_commit(struct rev_info *opt, struct commit *commit)\n \topt->loginfo = &log;\n \n \tshown = log_tree_diff(opt, commit, &log);\n-\tif (!shown && opt->loginfo && opt->always_show_header) {\n+\tif (!shown && opt->loginfo && REV_DIFF_TST(opt, ALWAYS_SHOW_HEADER)) {\n \t\tlog.parent = NULL;\n \t\tshow_log(opt);\n \t\tshown = 1;\ndiff --git a/pretty.c b/pretty.c\nindex 8eb39e9..38a9099 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -23,7 +23,7 @@ void get_commit_format(const char *arg, struct rev_info *rev)\n \t\t{ \"oneline\",\t1,\tCMIT_FMT_ONELINE },\n \t};\n \n-\trev->use_terminator = 0;\n+\tREV_FMT_CLR(rev, USE_TERMINATOR);\n \tif (!arg || !*arg) {\n \t\trev->commit_format = CMIT_FMT_DEFAULT;\n \t\treturn;\n@@ -33,7 +33,7 @@ void get_commit_format(const char *arg, struct rev_info *rev)\n \t\tfree(user_format);\n \t\tuser_format = xstrdup(cp);\n \t\tif (arg[0] == 't')\n-\t\t\trev->use_terminator = 1;\n+\t\t\tREV_FMT_SET(rev, USE_TERMINATOR);\n \t\trev->commit_format = CMIT_FMT_USERFORMAT;\n \t\treturn;\n \t}\n@@ -41,7 +41,7 @@ void get_commit_format(const char *arg, struct rev_info *rev)\n \t\tif (!strncmp(arg, cmt_fmts[i].n, cmt_fmts[i].cmp_len) &&\n \t\t    !strncmp(arg, cmt_fmts[i].n, strlen(arg))) {\n \t\t\tif (cmt_fmts[i].v == CMIT_FMT_ONELINE)\n-\t\t\t\trev->use_terminator = 1;\n+\t\t\t\tREV_FMT_SET(rev, USE_TERMINATOR);\n \t\t\trev->commit_format = cmt_fmts[i].v;\n \t\t\treturn;\n \t\t}\ndiff --git a/reachable.c b/reachable.c\nindex 3b1c18f..6ee77f9 100644\n--- a/reachable.c\n+++ b/reachable.c\n@@ -203,9 +203,9 @@ void mark_reachable_objects(struct rev_info *revs, int mark_reflog)\n \t * Set up revision parsing, and mark us as being interested\n \t * in all object types, not just commits.\n \t */\n-\trevs->tag_objects = 1;\n-\trevs->blob_objects = 1;\n-\trevs->tree_objects = 1;\n+\tREV_TRAV_SET(revs, TAG_OBJECTS);\n+\tREV_TRAV_SET(revs, BLOB_OBJECTS);\n+\tREV_TRAV_SET(revs, TREE_OBJECTS);\n \n \t/* Add all refs from the index file */\n \tadd_cache_refs(revs);\ndiff --git a/revision.c b/revision.c\nindex 4abe410..89036e7 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -131,7 +131,7 @@ void mark_parents_uninteresting(struct commit *commit)\n \n static void add_pending_object_with_mode(struct rev_info *revs, struct object *obj, const char *name, unsigned mode)\n {\n-\tif (revs->no_walk && (obj->flags & UNINTERESTING))\n+\tif (REV_TRAV_TST(revs, NO_WALK) && (obj->flags & UNINTERESTING))\n \t\tdie(\"object ranges do not make sense when not walking revisions\");\n \tif (revs->reflog_info && obj->type == OBJ_COMMIT &&\n \t\t\tadd_reflog_for_walk(revs->reflog_info,\n@@ -177,7 +177,7 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object\n \t */\n \twhile (object->type == OBJ_TAG) {\n \t\tstruct tag *tag = (struct tag *) object;\n-\t\tif (revs->tag_objects && !(flags & UNINTERESTING))\n+\t\tif (REV_TRAV_TST(revs, TAG_OBJECTS) && !(flags & UNINTERESTING))\n \t\t\tadd_pending_object(revs, object, tag->tag);\n \t\tif (!tag->tagged)\n \t\t\tdie(\"bad tag\");\n@@ -197,7 +197,7 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object\n \t\tif (flags & UNINTERESTING) {\n \t\t\tcommit->object.flags |= UNINTERESTING;\n \t\t\tmark_parents_uninteresting(commit);\n-\t\t\trevs->limited = 1;\n+\t\t\tREV_TRAV_SET(revs, LIMITED);\n \t\t}\n \t\treturn commit;\n \t}\n@@ -208,7 +208,7 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object\n \t */\n \tif (object->type == OBJ_TREE) {\n \t\tstruct tree *tree = (struct tree *)object;\n-\t\tif (!revs->tree_objects)\n+\t\tif (!REV_TRAV_TST(revs, TREE_OBJECTS))\n \t\t\treturn NULL;\n \t\tif (flags & UNINTERESTING) {\n \t\t\tmark_tree_uninteresting(tree);\n@@ -223,7 +223,7 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object\n \t */\n \tif (object->type == OBJ_BLOB) {\n \t\tstruct blob *blob = (struct blob *)object;\n-\t\tif (!revs->blob_objects)\n+\t\tif (!REV_TRAV_TST(revs, BLOB_OBJECTS))\n \t\t\treturn NULL;\n \t\tif (flags & UNINTERESTING) {\n \t\t\tmark_blob_uninteresting(blob);\n@@ -338,7 +338,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)\n \t/*\n \t * If we don't do pruning, everything is interesting\n \t */\n-\tif (!revs->prune)\n+\tif (!REV_TRAV_TST(revs, PRUNE))\n \t\treturn;\n \n \tif (!commit->tree)\n@@ -354,7 +354,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)\n \t * Normal non-merge commit? If we don't want to make the\n \t * history dense, we consider it always to be a change..\n \t */\n-\tif (!revs->dense && !commit->parents->next)\n+\tif (!REV_TRAV_TST(revs, DENSE) && !commit->parents->next)\n \t\treturn;\n \n \tpp = &commit->parents;\n@@ -368,7 +368,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)\n \t\tswitch (rev_compare_tree(revs, p->tree, commit->tree)) {\n \t\tcase REV_TREE_SAME:\n \t\t\ttree_same = 1;\n-\t\t\tif (!revs->simplify_history || (p->object.flags & UNINTERESTING)) {\n+\t\t\tif (!REV_TRAV_TST(revs, SIMPLIFY_HISTORY) || (p->object.flags & UNINTERESTING)) {\n \t\t\t\t/* Even if a merge with an uninteresting\n \t\t\t\t * side branch brought the entire change\n \t\t\t\t * we are interested in, we do not want\n@@ -384,7 +384,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)\n \t\t\treturn;\n \n \t\tcase REV_TREE_NEW:\n-\t\t\tif (revs->remove_empty_trees &&\n+\t\t\tif (REV_TRAV_TST(revs, REMOVE_EMPTY_TREES) &&\n \t\t\t    rev_same_tree_as_empty(revs, p->tree)) {\n \t\t\t\t/* We are adding all the specified\n \t\t\t\t * paths from this parent, so the\n@@ -458,7 +458,7 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit, str\n \t */\n \ttry_to_simplify_commit(revs, commit);\n \n-\tif (revs->no_walk)\n+\tif (REV_TRAV_TST(revs, NO_WALK))\n \t\treturn 0;\n \n \tleft_flag = (commit->object.flags & SYMMETRIC_LEFT);\n@@ -473,7 +473,7 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit, str\n \t\t\tp->object.flags |= SEEN;\n \t\t\tinsert_by_date(p, list);\n \t\t}\n-\t\tif(revs->first_parent_only)\n+\t\tif (REV_TRAV_TST(revs, FIRST_PARENT_ONLY))\n \t\t\tbreak;\n \t}\n \treturn 0;\n@@ -616,13 +616,13 @@ static int limit_list(struct rev_info *revs)\n \t\t\treturn -1;\n \t\tif (obj->flags & UNINTERESTING) {\n \t\t\tmark_parents_uninteresting(commit);\n-\t\t\tif (revs->show_all)\n+\t\t\tif (REV_TRAV_TST(revs, SHOW_ALL))\n \t\t\t\tp = &commit_list_insert(commit, p)->next;\n \t\t\tslop = still_interesting(list, date, slop);\n \t\t\tif (slop)\n \t\t\t\tcontinue;\n \t\t\t/* If showing all, add the whole pending list to the end */\n-\t\t\tif (revs->show_all)\n+\t\t\tif (REV_TRAV_TST(revs, SHOW_ALL))\n \t\t\t\t*p = list;\n \t\t\tbreak;\n \t\t}\n@@ -638,7 +638,7 @@ static int limit_list(struct rev_info *revs)\n \t\tshow(revs, newlist);\n \t\tshow_early_output = NULL;\n \t}\n-\tif (revs->cherry_pick)\n+\tif (REV_TRAV_TST(revs, CHERRY_PICK))\n \t\tcherry_pick_list(newlist, revs);\n \n \trevs->commits = newlist;\n@@ -750,14 +750,14 @@ void init_revisions(struct rev_info *revs, const char *prefix)\n \tmemset(revs, 0, sizeof(*revs));\n \n \trevs->abbrev = DEFAULT_ABBREV;\n-\trevs->ignore_merges = 1;\n-\trevs->simplify_history = 1;\n+\tREV_DIFF_SET(revs, IGNORE_MERGES);\n \tDIFF_OPT_SET(&revs->pruning, RECURSIVE);\n \tDIFF_OPT_SET(&revs->pruning, QUIET);\n \trevs->pruning.add_remove = file_add_remove;\n \trevs->pruning.change = file_change;\n-\trevs->lifo = 1;\n-\trevs->dense = 1;\n+\tREV_TRAV_SET(revs, SIMPLIFY_HISTORY);\n+\tREV_TRAV_SET(revs, LIFO);\n+\tREV_TRAV_SET(revs, DENSE);\n \trevs->prefix = prefix;\n \trevs->max_age = -1;\n \trevs->min_age = -1;\n@@ -821,7 +821,7 @@ static void prepare_show_merge(struct rev_info *revs)\n \t\t\ti++;\n \t}\n \trevs->prune_data = prune;\n-\trevs->limited = 1;\n+\tREV_TRAV_SET(revs, LIMITED);\n }\n \n int handle_revision_arg(const char *arg, struct rev_info *revs,\n@@ -1056,7 +1056,7 @@ int parse_revisions(int argc, const char **argv, struct rev_info *revs)\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--first-parent\")) {\n-\t\t\t\trevs->first_parent_only = 1;\n+\t\t\t\tREV_TRAV_SET(revs, FIRST_PARENT_ONLY);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--reflog\")) {\n@@ -1079,17 +1079,17 @@ int parse_revisions(int argc, const char **argv, struct rev_info *revs)\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--merge\")) {\n-\t\t\t\trevs->show_merge = 1;\n+\t\t\t\tREV_FMT_SET(revs, SHOW_MERGE);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--topo-order\")) {\n-\t\t\t\trevs->lifo = 1;\n-\t\t\t\trevs->topo_order = 1;\n+\t\t\t\tREV_TRAV_SET(revs, LIFO);\n+\t\t\t\tREV_TRAV_SET(revs, TOPO_ORDER);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--date-order\")) {\n-\t\t\t\trevs->lifo = 0;\n-\t\t\t\trevs->topo_order = 1;\n+\t\t\t\tREV_TRAV_CLR(revs, LIFO);\n+\t\t\t\tREV_TRAV_SET(revs, TOPO_ORDER);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!prefixcmp(arg, \"--early-output\")) {\n@@ -1099,131 +1099,131 @@ int parse_revisions(int argc, const char **argv, struct rev_info *revs)\n \t\t\t\t\tcount = atoi(arg+15);\n \t\t\t\t\t/* Fallthrough */\n \t\t\t\tcase 0:\n-\t\t\t\t\trevs->topo_order = 1;\n+\t\t\t\t\tREV_TRAV_SET(revs, TOPO_ORDER);\n \t\t\t\t\trevs->early_output = count;\n \t\t\t\t\tcontinue;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--parents\")) {\n-\t\t\t\trevs->rewrite_parents = 1;\n-\t\t\t\trevs->print_parents = 1;\n+\t\t\t\tREV_TRAV_SET(revs, REWRITE_PARENTS);\n+\t\t\t\tREV_TRAV_SET(revs, PRINT_PARENTS);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--dense\")) {\n-\t\t\t\trevs->dense = 1;\n+\t\t\t\tREV_TRAV_SET(revs, DENSE);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--sparse\")) {\n-\t\t\t\trevs->dense = 0;\n+\t\t\t\tREV_TRAV_CLR(revs, DENSE);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--show-all\")) {\n-\t\t\t\trevs->show_all = 1;\n+\t\t\t\tREV_TRAV_SET(revs, SHOW_ALL);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--remove-empty\")) {\n-\t\t\t\trevs->remove_empty_trees = 1;\n+\t\t\t\tREV_TRAV_SET(revs, REMOVE_EMPTY_TREES);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--no-merges\")) {\n-\t\t\t\trevs->no_merges = 1;\n+\t\t\t\tREV_TRAV_SET(revs, NO_MERGES);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--boundary\")) {\n-\t\t\t\trevs->boundary = 1;\n+\t\t\t\tREV_TRAV_SET(revs, BOUNDARY);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--left-right\")) {\n-\t\t\t\trevs->left_right = 1;\n+\t\t\t\tREV_TRAV_SET(revs, LEFT_RIGHT);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--cherry-pick\")) {\n-\t\t\t\trevs->cherry_pick = 1;\n-\t\t\t\trevs->limited = 1;\n+\t\t\t\tREV_TRAV_SET(revs, CHERRY_PICK);\n+\t\t\t\tREV_TRAV_SET(revs, LIMITED);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--objects\")) {\n-\t\t\t\trevs->tag_objects = 1;\n-\t\t\t\trevs->tree_objects = 1;\n-\t\t\t\trevs->blob_objects = 1;\n+\t\t\t\tREV_TRAV_SET(revs, TAG_OBJECTS);\n+\t\t\t\tREV_TRAV_SET(revs, TREE_OBJECTS);\n+\t\t\t\tREV_TRAV_SET(revs, BLOB_OBJECTS);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--objects-edge\")) {\n-\t\t\t\trevs->tag_objects = 1;\n-\t\t\t\trevs->tree_objects = 1;\n-\t\t\t\trevs->blob_objects = 1;\n-\t\t\t\trevs->edge_hint = 1;\n+\t\t\t\tREV_TRAV_SET(revs, TAG_OBJECTS);\n+\t\t\t\tREV_TRAV_SET(revs, TREE_OBJECTS);\n+\t\t\t\tREV_TRAV_SET(revs, BLOB_OBJECTS);\n+\t\t\t\tREV_TRAV_SET(revs, EDGE_HINT);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--unpacked\")) {\n-\t\t\t\trevs->unpacked = 1;\n+\t\t\t\tREV_TRAV_SET(revs, UNPACKED);\n \t\t\t\tfree(revs->ignore_packed);\n \t\t\t\trevs->ignore_packed = NULL;\n \t\t\t\trevs->num_ignore_packed = 0;\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!prefixcmp(arg, \"--unpacked=\")) {\n-\t\t\t\trevs->unpacked = 1;\n+\t\t\t\tREV_TRAV_SET(revs, UNPACKED);\n \t\t\t\tadd_ignore_packed(revs, arg+11);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"-r\")) {\n-\t\t\t\trevs->diff = 1;\n+\t\t\t\tREV_DIFF_SET(revs, DIFF);\n \t\t\t\tDIFF_OPT_SET(&revs->diffopt, RECURSIVE);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"-t\")) {\n-\t\t\t\trevs->diff = 1;\n+\t\t\t\tREV_DIFF_SET(revs, DIFF);\n \t\t\t\tDIFF_OPT_SET(&revs->diffopt, RECURSIVE);\n \t\t\t\tDIFF_OPT_SET(&revs->diffopt, TREE_IN_RECURSIVE);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"-m\")) {\n-\t\t\t\trevs->ignore_merges = 0;\n+\t\t\t\tREV_DIFF_CLR(revs, IGNORE_MERGES);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"-c\")) {\n-\t\t\t\trevs->diff = 1;\n-\t\t\t\trevs->dense_combined_merges = 0;\n-\t\t\t\trevs->combine_merges = 1;\n+\t\t\t\tREV_DIFF_SET(revs, DIFF);\n+\t\t\t\tREV_DIFF_CLR(revs, DENSE_COMBINED_MERGES);\n+\t\t\t\tREV_DIFF_SET(revs, COMBINE_MERGES);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--cc\")) {\n-\t\t\t\trevs->diff = 1;\n-\t\t\t\trevs->dense_combined_merges = 1;\n-\t\t\t\trevs->combine_merges = 1;\n+\t\t\t\tREV_DIFF_SET(revs, DIFF);\n+\t\t\t\tREV_DIFF_SET(revs, DENSE_COMBINED_MERGES);\n+\t\t\t\tREV_DIFF_SET(revs, COMBINE_MERGES);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"-v\")) {\n-\t\t\t\trevs->verbose_header = 1;\n+\t\t\t\tREV_DIFF_SET(revs, VERBOSE_HEADER);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--pretty\")) {\n-\t\t\t\trevs->verbose_header = 1;\n+\t\t\t\tREV_DIFF_SET(revs, VERBOSE_HEADER);\n \t\t\t\tget_commit_format(arg+8, revs);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!prefixcmp(arg, \"--pretty=\")) {\n-\t\t\t\trevs->verbose_header = 1;\n+\t\t\t\tREV_DIFF_SET(revs, VERBOSE_HEADER);\n \t\t\t\tget_commit_format(arg+9, revs);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--graph\")) {\n-\t\t\t\trevs->topo_order = 1;\n-\t\t\t\trevs->rewrite_parents = 1;\n+\t\t\t\tREV_TRAV_SET(revs, TOPO_ORDER);\n+\t\t\t\tREV_TRAV_SET(revs, REWRITE_PARENTS);\n \t\t\t\trevs->graph = graph_init(revs);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--root\")) {\n-\t\t\t\trevs->show_root_diff = 1;\n+\t\t\t\tREV_DIFF_SET(revs, SHOW_ROOT_DIFF);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--no-commit-id\")) {\n-\t\t\t\trevs->no_commit_id = 1;\n+\t\t\t\tREV_DIFF_SET(revs, NO_COMMIT_ID);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--always\")) {\n-\t\t\t\trevs->always_show_header = 1;\n+\t\t\t\tREV_DIFF_SET(revs, ALWAYS_SHOW_HEADER);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--no-abbrev\")) {\n@@ -1243,16 +1243,16 @@ int parse_revisions(int argc, const char **argv, struct rev_info *revs)\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--abbrev-commit\")) {\n-\t\t\t\trevs->abbrev_commit = 1;\n+\t\t\t\tREV_FMT_SET(revs, ABBREV_COMMIT);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--full-diff\")) {\n-\t\t\t\trevs->diff = 1;\n-\t\t\t\trevs->full_diff = 1;\n+\t\t\t\tREV_DIFF_SET(revs, DIFF);\n+\t\t\t\tREV_DIFF_SET(revs, FULL_DIFF);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--full-history\")) {\n-\t\t\t\trevs->simplify_history = 0;\n+\t\t\t\tREV_TRAV_CLR(revs, SIMPLIFY_HISTORY);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--relative-date\")) {\n@@ -1311,20 +1311,20 @@ int parse_revisions(int argc, const char **argv, struct rev_info *revs)\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--reverse\")) {\n-\t\t\t\trevs->reverse ^= 1;\n+\t\t\t\tREV_TRAV_XOR(revs, REVERSE);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--no-walk\")) {\n-\t\t\t\trevs->no_walk = 1;\n+\t\t\t\tREV_TRAV_SET(revs, NO_WALK);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--do-walk\")) {\n-\t\t\t\trevs->no_walk = 0;\n+\t\t\t\tREV_TRAV_CLR(revs, NO_WALK);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--children\")) {\n \t\t\t\trevs->children.name = \"children\";\n-\t\t\t\trevs->limited = 1;\n+\t\t\t\tREV_TRAV_SET(revs, LIMITED);\n \t\t\t\tcontinue;\n \t\t\t}\n \n@@ -1370,7 +1370,7 @@ void setup_revisions(struct rev_info *revs, const char *def)\n {\n \tif (revs->def == NULL)\n \t\trevs->def = def;\n-\tif (revs->show_merge)\n+\tif (REV_FMT_TST(revs, SHOW_MERGE))\n \t\tprepare_show_merge(revs);\n \tif (revs->def && !revs->pending.nr) {\n \t\tunsigned char sha1[20];\n@@ -1384,28 +1384,28 @@ void setup_revisions(struct rev_info *revs, const char *def)\n \n \t/* Did the user ask for any diff output? Run the diff! */\n \tif (revs->diffopt.output_format & ~DIFF_FORMAT_NO_OUTPUT)\n-\t\trevs->diff = 1;\n+\t\tREV_DIFF_SET(revs, DIFF);\n \n \t/* Pickaxe, diff-filter and rename following need diffs */\n \tif (revs->diffopt.pickaxe ||\n \t    revs->diffopt.filter ||\n \t    DIFF_OPT_TST(&revs->diffopt, FOLLOW_RENAMES))\n-\t\trevs->diff = 1;\n+\t\tREV_DIFF_SET(revs, DIFF);\n \n-\tif (revs->topo_order)\n-\t\trevs->limited = 1;\n+\tif (REV_TRAV_TST(revs, TOPO_ORDER))\n+\t\tREV_TRAV_SET(revs, LIMITED);\n \n \tif (revs->prune_data) {\n \t\tdiff_tree_setup_paths(revs->prune_data, &revs->pruning);\n \t\t/* Can't prune commits with rename following: the paths change.. */\n \t\tif (!DIFF_OPT_TST(&revs->diffopt, FOLLOW_RENAMES))\n-\t\t\trevs->prune = 1;\n-\t\tif (!revs->full_diff)\n+\t\t\tREV_TRAV_SET(revs, PRUNE);\n+\t\tif (!REV_DIFF_TST(revs, FULL_DIFF))\n \t\t\tdiff_tree_setup_paths(revs->prune_data, &revs->diffopt);\n \t}\n-\tif (revs->combine_merges) {\n-\t\trevs->ignore_merges = 0;\n-\t\tif (revs->dense_combined_merges && !revs->diffopt.output_format)\n+\tif (REV_DIFF_TST(revs, COMBINE_MERGES)) {\n+\t\tREV_DIFF_CLR(revs, IGNORE_MERGES);\n+\t\tif (REV_DIFF_TST(revs, DENSE_COMBINED_MERGES) && !revs->diffopt.output_format)\n \t\t\trevs->diffopt.output_format = DIFF_FORMAT_PATCH;\n \t}\n \trevs->diffopt.abbrev = revs->abbrev;\n@@ -1416,15 +1416,15 @@ void setup_revisions(struct rev_info *revs, const char *def)\n \t\tcompile_grep_patterns(revs->grep_filter);\n \t}\n \n-\tif (revs->reverse && revs->reflog_info)\n+\tif (REV_TRAV_TST(revs, REVERSE) && revs->reflog_info)\n \t\tdie(\"cannot combine --reverse with --walk-reflogs\");\n-\tif (revs->rewrite_parents && revs->children.name)\n+\tif (REV_TRAV_TST(revs, REWRITE_PARENTS) && revs->children.name)\n \t\tdie(\"cannot combine --parents and --children\");\n \n \t/*\n \t * Limitations on the graph functionality\n \t */\n-\tif (revs->reverse && revs->graph)\n+\tif (REV_TRAV_TST(revs, REVERSE) && revs->graph)\n \t\tdie(\"cannot combine --reverse with --graph\");\n \n \tif (revs->reflog_info && revs->graph)\n@@ -1472,13 +1472,13 @@ int prepare_revision_walk(struct rev_info *revs)\n \t}\n \tfree(list);\n \n-\tif (revs->no_walk)\n+\tif (REV_TRAV_TST(revs, NO_WALK))\n \t\treturn 0;\n-\tif (revs->limited)\n+\tif (REV_TRAV_TST(revs, LIMITED))\n \t\tif (limit_list(revs) < 0)\n \t\t\treturn -1;\n-\tif (revs->topo_order)\n-\t\tsort_in_topological_order(&revs->commits, revs->lifo);\n+\tif (REV_TRAV_TST(revs, TOPO_ORDER))\n+\t\tsort_in_topological_order(&revs->commits, REV_TRAV_TST(revs, LIFO));\n \tif (revs->children.name)\n \t\tset_children(revs);\n \treturn 0;\n@@ -1494,7 +1494,7 @@ static enum rewrite_result rewrite_one(struct rev_info *revs, struct commit **pp\n {\n \tfor (;;) {\n \t\tstruct commit *p = *pp;\n-\t\tif (!revs->limited)\n+\t\tif (!REV_TRAV_TST(revs, LIMITED))\n \t\t\tif (add_parents_to_list(revs, p, &revs->commits) < 0)\n \t\t\t\treturn rewrite_one_error;\n \t\tif (p->parents && p->parents->next)\n@@ -1560,26 +1560,26 @@ static int commit_match(struct commit *commit, struct rev_info *opt)\n \n static inline int want_ancestry(struct rev_info *revs)\n {\n-\treturn (revs->rewrite_parents || revs->children.name);\n+\treturn (REV_TRAV_TST(revs, REWRITE_PARENTS) || revs->children.name);\n }\n \n enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit)\n {\n \tif (commit->object.flags & SHOWN)\n \t\treturn commit_ignore;\n-\tif (revs->unpacked && has_sha1_pack(commit->object.sha1, revs->ignore_packed))\n+\tif (REV_TRAV_TST(revs, UNPACKED) && has_sha1_pack(commit->object.sha1, revs->ignore_packed))\n \t\treturn commit_ignore;\n-\tif (revs->show_all)\n+\tif (REV_TRAV_TST(revs, SHOW_ALL))\n \t\treturn commit_show;\n \tif (commit->object.flags & UNINTERESTING)\n \t\treturn commit_ignore;\n \tif (revs->min_age != -1 && (commit->date > revs->min_age))\n \t\treturn commit_ignore;\n-\tif (revs->no_merges && commit->parents && commit->parents->next)\n+\tif (REV_TRAV_TST(revs, NO_MERGES) && commit->parents && commit->parents->next)\n \t\treturn commit_ignore;\n \tif (!commit_match(commit, revs))\n \t\treturn commit_ignore;\n-\tif (revs->prune && revs->dense) {\n+\tif (REV_TRAV_TST(revs, PRUNE) && REV_TRAV_TST(revs, DENSE)) {\n \t\t/* Commit without changes? */\n \t\tif (commit->object.flags & TREESAME) {\n \t\t\t/* drop merges unless we want parenthood */\n@@ -1615,7 +1615,7 @@ static struct commit *get_revision_1(struct rev_info *revs)\n \t\t * the parents here. We also need to do the date-based limiting\n \t\t * that we'd otherwise have done in limit_list().\n \t\t */\n-\t\tif (!revs->limited) {\n+\t\tif (!REV_TRAV_TST(revs, LIMITED)) {\n \t\t\tif (revs->max_age != -1 &&\n \t\t\t    (commit->date < revs->max_age))\n \t\t\t\tcontinue;\n@@ -1694,7 +1694,7 @@ static void create_boundary_commit_list(struct rev_info *revs)\n \t * If revs->topo_order is set, sort the boundary commits\n \t * in topological order\n \t */\n-\tsort_in_topological_order(&revs->commits, revs->lifo);\n+\tsort_in_topological_order(&revs->commits, REV_TRAV_TST(revs, LIFO));\n }\n \n static struct commit *get_revision_internal(struct rev_info *revs)\n@@ -1702,7 +1702,7 @@ static struct commit *get_revision_internal(struct rev_info *revs)\n \tstruct commit *c = NULL;\n \tstruct commit_list *l;\n \n-\tif (revs->boundary == 2) {\n+\tif (REV_TRAV_TST(revs, BOUNDARY_OUTPUT)) {\n \t\t/*\n \t\t * All of the normal commits have already been returned,\n \t\t * and we are now returning boundary commits.\n@@ -1715,7 +1715,7 @@ static struct commit *get_revision_internal(struct rev_info *revs)\n \t\treturn c;\n \t}\n \n-\tif (revs->reverse) {\n+\tif (REV_TRAV_TST(revs, REVERSE)) {\n \t\tint limit = -1;\n \n \t\tif (0 <= revs->max_count) {\n@@ -1730,7 +1730,7 @@ static struct commit *get_revision_internal(struct rev_info *revs)\n \t\t\t\tbreak;\n \t\t}\n \t\trevs->commits = l;\n-\t\trevs->reverse = 0;\n+\t\tREV_TRAV_CLR(revs, REVERSE);\n \t\trevs->max_count = -1;\n \t\tc = NULL;\n \t}\n@@ -1764,7 +1764,7 @@ static struct commit *get_revision_internal(struct rev_info *revs)\n \tif (c)\n \t\tc->object.flags |= SHOWN;\n \n-\tif (!revs->boundary) {\n+\tif (!REV_TRAV_TST(revs, BOUNDARY)) {\n \t\treturn c;\n \t}\n \n@@ -1774,7 +1774,7 @@ static struct commit *get_revision_internal(struct rev_info *revs)\n \t\t * we are done computing the boundaries.\n \t\t * switch to boundary commits output mode.\n \t\t */\n-\t\trevs->boundary = 2;\n+\t\tREV_TRAV_SET(revs, BOUNDARY_OUTPUT);\n \n \t\t/*\n \t\t * Update revs->commits to contain the list of\ndiff --git a/revision.h b/revision.h\nindex 72ab144..5c95b9b 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -15,6 +15,57 @@\n struct rev_info;\n struct log_info;\n \n+/* rev_info traversal flags */\n+#define REV_TRAV_DENSE               (1u <<  0)\n+#define REV_TRAV_PRUNE               (1u <<  1)\n+#define REV_TRAV_NO_MERGES           (1u <<  2)\n+#define REV_TRAV_NO_WALK             (1u <<  3)\n+#define REV_TRAV_SHOW_ALL            (1u <<  4)\n+#define REV_TRAV_REMOVE_EMPTY_TREES  (1u <<  5)\n+#define REV_TRAV_SIMPLIFY_HISTORY    (1u <<  6)\n+#define REV_TRAV_LIFO                (1u <<  7)\n+#define REV_TRAV_TOPO_ORDER          (1u <<  8)\n+#define REV_TRAV_TAG_OBJECTS         (1u <<  9)\n+#define REV_TRAV_TREE_OBJECTS        (1u << 10)\n+#define REV_TRAV_BLOB_OBJECTS        (1u << 11)\n+#define REV_TRAV_EDGE_HINT           (1u << 12)\n+#define REV_TRAV_LIMITED             (1u << 13)\n+#define REV_TRAV_UNPACKED            (1u << 14)\n+#define REV_TRAV_BOUNDARY            (1u << 15)\n+#define REV_TRAV_BOUNDARY_OUTPUT     (1u << 16)\n+#define REV_TRAV_LEFT_RIGHT          (1u << 17)\n+#define REV_TRAV_REWRITE_PARENTS     (1u << 18)\n+#define REV_TRAV_PRINT_PARENTS       (1u << 19)\n+#define REV_TRAV_REVERSE             (1u << 20)\n+#define REV_TRAV_CHERRY_PICK         (1u << 21)\n+#define REV_TRAV_FIRST_PARENT_ONLY   (1u << 22)\n+#define REV_TRAV_TST(rev, flag)      ((rev)->trav_flags & REV_TRAV_##flag)\n+#define REV_TRAV_SET(rev, flag)      ((rev)->trav_flags |= REV_TRAV_##flag)\n+#define REV_TRAV_XOR(rev, flag)      ((rev)->trav_flags ^= REV_TRAV_##flag)\n+#define REV_TRAV_CLR(rev, flag)      ((rev)->trav_flags &= ~REV_TRAV_##flag)\n+\n+#define REV_DIFF_DIFF                   (1u << 0)\n+#define REV_DIFF_FULL_DIFF              (1u << 1)\n+#define REV_DIFF_SHOW_ROOT_DIFF         (1u << 2)\n+#define REV_DIFF_NO_COMMIT_ID           (1u << 3)\n+#define REV_DIFF_VERBOSE_HEADER         (1u << 4)\n+#define REV_DIFF_IGNORE_MERGES          (1u << 5)\n+#define REV_DIFF_COMBINE_MERGES         (1u << 6)\n+#define REV_DIFF_DENSE_COMBINED_MERGES  (1u << 7)\n+#define REV_DIFF_ALWAYS_SHOW_HEADER     (1u << 8)\n+#define REV_DIFF_TST(rev, flag)      ((rev)->diff_flags & REV_DIFF_##flag)\n+#define REV_DIFF_SET(rev, flag)      ((rev)->diff_flags |= REV_DIFF_##flag)\n+#define REV_DIFF_CLR(rev, flag)      ((rev)->diff_flags &= ~REV_DIFF_##flag)\n+\n+#define REV_FMT_SHOWN_ONE               (1u << 0)\n+#define REV_FMT_SHOW_MERGE              (1u << 1)\n+#define REV_FMT_ABBREV_COMMIT           (1u << 2)\n+#define REV_FMT_USE_TERMINATOR          (1u << 3)\n+#define REV_FMT_MISSING_NEWLINE         (1u << 4)\n+#define REV_FMT_TST(rev, flag)       ((rev)->fmt_flags & REV_FMT_##flag)\n+#define REV_FMT_SET(rev, flag)       ((rev)->fmt_flags |= REV_FMT_##flag)\n+#define REV_FMT_CLR(rev, flag)       ((rev)->fmt_flags &= ~REV_FMT_##flag)\n+\n struct rev_info {\n \t/* Starting list */\n \tstruct commit_list *commits;\n@@ -29,47 +80,9 @@ struct rev_info {\n \tvoid *prune_data;\n \tunsigned int early_output;\n \n-\t/* Traversal flags */\n-\tunsigned int\tdense:1,\n-\t\t\tprune:1,\n-\t\t\tno_merges:1,\n-\t\t\tno_walk:1,\n-\t\t\tshow_all:1,\n-\t\t\tremove_empty_trees:1,\n-\t\t\tsimplify_history:1,\n-\t\t\tlifo:1,\n-\t\t\ttopo_order:1,\n-\t\t\ttag_objects:1,\n-\t\t\ttree_objects:1,\n-\t\t\tblob_objects:1,\n-\t\t\tedge_hint:1,\n-\t\t\tlimited:1,\n-\t\t\tunpacked:1, /* see also ignore_packed below */\n-\t\t\tboundary:2,\n-\t\t\tleft_right:1,\n-\t\t\trewrite_parents:1,\n-\t\t\tprint_parents:1,\n-\t\t\treverse:1,\n-\t\t\tcherry_pick:1,\n-\t\t\tfirst_parent_only:1;\n-\n-\t/* Diff flags */\n-\tunsigned int\tdiff:1,\n-\t\t\tfull_diff:1,\n-\t\t\tshow_root_diff:1,\n-\t\t\tno_commit_id:1,\n-\t\t\tverbose_header:1,\n-\t\t\tignore_merges:1,\n-\t\t\tcombine_merges:1,\n-\t\t\tdense_combined_merges:1,\n-\t\t\talways_show_header:1;\n-\n-\t/* Format info */\n-\tunsigned int\tshown_one:1,\n-\t\t\tshow_merge:1,\n-\t\t\tuse_terminator:1,\n-\t\t\tabbrev_commit:1,\n-\t\t\tmissing_newline:1;\n+\tunsigned int trav_flags; /* Traversal flags */\n+\tunsigned int diff_flags; /* Diff flags */\n+\tunsigned int fmt_flags;  /* Format info */\n \tenum date_mode date_mode;\n \n \tconst char **ignore_packed; /* pretend objects in these are unpacked */\ndiff --git a/upload-pack.c b/upload-pack.c\nindex 9d031fc..78bc4b8 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -108,11 +108,11 @@ static int do_rev_list(int fd, void *create_full_pack)\n \tif (create_full_pack)\n \t\tuse_thin_pack = 0; /* no point doing it */\n \tinit_revisions(&revs, NULL);\n-\trevs.tag_objects = 1;\n-\trevs.tree_objects = 1;\n-\trevs.blob_objects = 1;\n+\tREV_TRAV_SET(&revs, TAG_OBJECTS);\n+\tREV_TRAV_SET(&revs, BLOB_OBJECTS);\n+\tREV_TRAV_SET(&revs, TREE_OBJECTS);\n \tif (use_thin_pack)\n-\t\trevs.edge_hint = 1;\n+\t\tREV_TRAV_SET(&revs, EDGE_HINT);\n \n \tif (create_full_pack) {\n \t\tconst char *args[] = {\"rev-list\", \"--all\", NULL};\n-- \n1.5.6.rc0.145.gbc48c\n"}]}