{"thread":{"id":"43775","subject":"[PATCH 1/2] Teach all of log family --left-right output.","startedAt":"2006-12-17T00:12:47Z","lastAt":"2006-12-17T00:12:47Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"298524","messageId":"7vmz5n8jnk.fsf@assigned-by-dhcp.cox.net","threadId":"43775","inReplyTo":null,"subject":"[PATCH 1/2] Teach all of log family --left-right output.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-12-17T00:12:47Z","receivedAt":"2006-12-17T00:12:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This makes reviewing\n\n     git log --left-right --merge --no-merges -p\n\na lot more pleasant.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n * This is on the tip of jc/leftright topic, currently only in\n   'pu'.  Earlier I had this only for git-rev-list.  Now log\n   family knows about this.\n\n builtin-rev-list.c |    7 +------\n log-tree.c         |   26 ++++++++++++++++++++++----\n revision.c         |    4 ++++\n revision.h         |    1 +\n 4 files changed, 28 insertions(+), 10 deletions(-)\n\ndiff --git a/builtin-rev-list.c b/builtin-rev-list.c\nindex 4364035..1bb3a06 100644\n--- a/builtin-rev-list.c\n+++ b/builtin-rev-list.c\n@@ -45,7 +45,6 @@ static int bisect_list;\n static int show_timestamp;\n static int hdr_termination;\n static const char *header_prefix;\n-static int show_left_right;\n \n static void show_commit(struct commit *commit)\n {\n@@ -55,7 +54,7 @@ static void show_commit(struct commit *commit)\n \t\tfputs(header_prefix, stdout);\n \tif (commit->object.flags & BOUNDARY)\n \t\tputchar('-');\n-\telse if (show_left_right) {\n+\telse if (revs.left_right) {\n \t\tif (commit->object.flags & SYMMETRIC_LEFT)\n \t\t\tputchar('<');\n \t\telse\n@@ -247,10 +246,6 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n \t\t\tbisect_list = 1;\n \t\t\tcontinue;\n \t\t}\n-\t\tif (!strcmp(arg, \"--left-right\")) {\n-\t\t\tshow_left_right = 1;\n-\t\t\tcontinue;\n-\t\t}\n \t\tif (!strcmp(arg, \"--stdin\")) {\n \t\t\tif (read_from_stdin++)\n \t\t\t\tdie(\"--stdin given twice?\");\ndiff --git a/log-tree.c b/log-tree.c\nindex 8787df5..35be33a 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -114,6 +114,14 @@ void show_log(struct rev_info *opt, const char *sep)\n \n \topt->loginfo = NULL;\n \tif (!opt->verbose_header) {\n+\t\tif (opt->left_right) {\n+\t\t\tif (commit->object.flags & BOUNDARY)\n+\t\t\t\tputchar('-');\n+\t\t\telse if (commit->object.flags & SYMMETRIC_LEFT)\n+\t\t\t\tputchar('<');\n+\t\t\telse\n+\t\t\t\tputchar('>');\n+\t\t}\n \t\tfputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);\n \t\tif (opt->parents)\n \t\t\tshow_parents(commit, abbrev_commit);\n@@ -192,10 +200,20 @@ void show_log(struct rev_info *opt, const char *sep)\n \t\t\topt->diffopt.stat_sep = buffer;\n \t\t}\n \t} else {\n-\t\tprintf(\"%s%s%s\",\n-\t\t       diff_get_color(opt->diffopt.color_diff, DIFF_COMMIT),\n-\t\t       opt->commit_format == CMIT_FMT_ONELINE ? \"\" : \"commit \",\n-\t\t       diff_unique_abbrev(commit->object.sha1, abbrev_commit));\n+\t\tfputs(diff_get_color(opt->diffopt.color_diff, DIFF_COMMIT),\n+\t\t      stdout);\n+\t\tif (opt->commit_format != CMIT_FMT_ONELINE)\n+\t\t\tfputs(\"commit \", stdout);\n+\t\tif (opt->left_right) {\n+\t\t\tif (commit->object.flags & BOUNDARY)\n+\t\t\t\tputchar('-');\n+\t\t\telse if (commit->object.flags & SYMMETRIC_LEFT)\n+\t\t\t\tputchar('<');\n+\t\t\telse\n+\t\t\t\tputchar('>');\n+\t\t}\n+\t\tfputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit),\n+\t\t      stdout);\n \t\tif (opt->parents)\n \t\t\tshow_parents(commit, abbrev_commit);\n \t\tif (parent)\ndiff --git a/revision.c b/revision.c\nindex 3d989c3..d84f46e 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -853,6 +853,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch\n \t\t\t\trevs->boundary = 1;\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\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;\ndiff --git a/revision.h b/revision.h\nindex f92a4d4..4585463 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -41,6 +41,7 @@ struct rev_info {\n \t\t\tlimited:1,\n \t\t\tunpacked:1, /* see also ignore_packed below */\n \t\t\tboundary:1,\n+\t\t\tleft_right:1,\n \t\t\tparents:1;\n \n \t/* Diff flags */\n-- \n1.4.4.2.g83c5\n\n"}]}