{"thread":{"id":"29776","subject":"[PATCH 1/2] rev-list: remove BISECT_SHOW_TRIED flag","startedAt":"2012-02-28T13:59:59Z","lastAt":"2012-02-28T14:00:00Z","messageCount":2,"participants":["Nguyễn Thái Ngọc Duy"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"185623","messageId":"1330437600-9425-1-git-send-email-pclouds@gmail.com","threadId":"29776","inReplyTo":null,"subject":"[PATCH 1/2] rev-list: remove BISECT_SHOW_TRIED flag","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2012-02-28T13:59:59Z","receivedAt":"2012-02-28T13:59:59Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Since c99f069 (bisect--helper: remove \"--next-vars\" option as it is\nnow useless - 2009-04-21), this flag has always been off. Remove the\nflag and all related code.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n bisect.h           |    1 -\n builtin/rev-list.c |   12 +-----------\n 2 files changed, 1 insertions(+), 12 deletions(-)\n\ndiff --git a/bisect.h b/bisect.h\nindex 22f2e4d..b06949e 100644\n--- a/bisect.h\n+++ b/bisect.h\n@@ -17,7 +17,6 @@ extern void print_commit_list(struct commit_list *list,\n \n /* bisect_show_flags flags in struct rev_list_info */\n #define BISECT_SHOW_ALL\t\t(1<<0)\n-#define BISECT_SHOW_TRIED\t(1<<1)\n \n struct rev_list_info {\n \tstruct rev_info *revs;\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex 264e3ae..7a3f820 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -242,13 +242,6 @@ void print_commit_list(struct commit_list *list,\n \t}\n }\n \n-static void show_tried_revs(struct commit_list *tried)\n-{\n-\tprintf(\"bisect_tried='\");\n-\tprint_commit_list(tried, \"%s|\", \"%s\");\n-\tprintf(\"'\\n\");\n-}\n-\n static void print_var_str(const char *var, const char *val)\n {\n \tprintf(\"%s='%s'\\n\", var, val);\n@@ -266,7 +259,7 @@ static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)\n \tstruct commit_list *tried;\n \tstruct rev_info *revs = info->revs;\n \n-\tif (!revs->commits && !(flags & BISECT_SHOW_TRIED))\n+\tif (!revs->commits)\n \t\treturn 1;\n \n \trevs->commits = filter_skipped(revs->commits, &tried,\n@@ -294,9 +287,6 @@ static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)\n \t\tprintf(\"------\\n\");\n \t}\n \n-\tif (flags & BISECT_SHOW_TRIED)\n-\t\tshow_tried_revs(tried);\n-\n \tprint_var_str(\"bisect_rev\", hex);\n \tprint_var_int(\"bisect_nr\", cnt - 1);\n \tprint_var_int(\"bisect_good\", all - reaches - 1);\n-- \n1.7.8.36.g69ee2\n"},{"id":"185624","messageId":"1330437600-9425-2-git-send-email-pclouds@gmail.com","threadId":"29776","inReplyTo":"1330437600-9425-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 2/2] rev-list: fix --verify-objects --quiet becoming --objects","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2012-02-28T14:00:00Z","receivedAt":"2012-02-28T14:00:00Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"When --quiet is specified, finish_object() is called instead of\nshow_object(). The latter is in charge of --verify-objects and\nwill be skipped  if --quiet is specified.\n\nMove the code up to finish_object(). Also pass the quiet flag along\nand make it always call show_* functions to avoid similar problems in\nfuture.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n bisect.h           |    4 ++--\n builtin/rev-list.c |   26 +++++++++++++++-----------\n 2 files changed, 17 insertions(+), 13 deletions(-)\n\ndiff --git a/bisect.h b/bisect.h\nindex b06949e..ec3c3ff 100644\n--- a/bisect.h\n+++ b/bisect.h\n@@ -15,12 +15,12 @@ extern void print_commit_list(struct commit_list *list,\n \t\t\t      const char *format_cur,\n \t\t\t      const char *format_last);\n \n-/* bisect_show_flags flags in struct rev_list_info */\n #define BISECT_SHOW_ALL\t\t(1<<0)\n+#define REV_LIST_QUIET\t\t(1<<1)\n \n struct rev_list_info {\n \tstruct rev_info *revs;\n-\tint bisect_show_flags;\n+\tint flags;\n \tint show_timestamp;\n \tint hdr_termination;\n \tconst char *header_prefix;\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex 7a3f820..4c4d404 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -52,6 +52,11 @@ static void show_commit(struct commit *commit, void *data)\n \tstruct rev_list_info *info = data;\n \tstruct rev_info *revs = info->revs;\n \n+\tif (info->flags & REV_LIST_QUIET) {\n+\t\tfinish_commit(commit, data);\n+\t\treturn;\n+\t}\n+\n \tgraph_show_commit(revs->graph);\n \n \tif (revs->count) {\n@@ -172,8 +177,11 @@ static void finish_object(struct object *obj,\n \t\t\t  const struct name_path *path, const char *name,\n \t\t\t  void *cb_data)\n {\n+\tstruct rev_list_info *info = cb_data;\n \tif (obj->type == OBJ_BLOB && !has_sha1_file(obj->sha1))\n \t\tdie(\"missing blob object '%s'\", sha1_to_hex(obj->sha1));\n+\tif (info->revs->verify_objects && !obj->parsed && obj->type != OBJ_COMMIT)\n+\t\tparse_object(obj->sha1);\n }\n \n static void show_object(struct object *obj,\n@@ -181,10 +189,9 @@ static void show_object(struct object *obj,\n \t\t\tvoid *cb_data)\n {\n \tstruct rev_list_info *info = cb_data;\n-\n \tfinish_object(obj, path, component, cb_data);\n-\tif (info->revs->verify_objects && !obj->parsed && obj->type != OBJ_COMMIT)\n-\t\tparse_object(obj->sha1);\n+\tif (info->flags & REV_LIST_QUIET)\n+\t\treturn;\n \tshow_object_with_name(stdout, obj, path, component);\n }\n \n@@ -254,7 +261,7 @@ static void print_var_int(const char *var, int val)\n \n static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)\n {\n-\tint cnt, flags = info->bisect_show_flags;\n+\tint cnt, flags = info->flags;\n \tchar hex[41] = \"\";\n \tstruct commit_list *tried;\n \tstruct rev_info *revs = info->revs;\n@@ -305,7 +312,6 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n \tint bisect_list = 0;\n \tint bisect_show_vars = 0;\n \tint bisect_find_all = 0;\n-\tint quiet = 0;\n \n \tgit_config(git_default_config, NULL);\n \tinit_revisions(&revs, prefix);\n@@ -318,7 +324,8 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n \tif (revs.bisect)\n \t\tbisect_list = 1;\n \n-\tquiet = DIFF_OPT_TST(&revs.diffopt, QUICK);\n+\tif (DIFF_OPT_TST(&revs.diffopt, QUICK))\n+\t\tinfo.flags |= REV_LIST_QUIET;\n \tfor (i = 1 ; i < argc; i++) {\n \t\tconst char *arg = argv[i];\n \n@@ -337,7 +344,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n \t\tif (!strcmp(arg, \"--bisect-all\")) {\n \t\t\tbisect_list = 1;\n \t\t\tbisect_find_all = 1;\n-\t\t\tinfo.bisect_show_flags = BISECT_SHOW_ALL;\n+\t\t\tinfo.flags |= BISECT_SHOW_ALL;\n \t\t\trevs.show_decorations = 1;\n \t\t\tcontinue;\n \t\t}\n@@ -388,10 +395,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n \t\t\treturn show_bisect_vars(&info, reaches, all);\n \t}\n \n-\ttraverse_commit_list(&revs,\n-\t\t\t     quiet ? finish_commit : show_commit,\n-\t\t\t     quiet ? finish_object : show_object,\n-\t\t\t     &info);\n+\ttraverse_commit_list(&revs, show_commit, show_object, &info);\n \n \tif (revs.count) {\n \t\tif (revs.left_right && revs.cherry_mark)\n-- \n1.7.8.36.g69ee2\n"}]}