{"thread":{"id":"33395","subject":"[PATCH v2] submodule: print graph output next to submodule log","startedAt":"2013-04-05T16:06:30Z","lastAt":"2013-04-05T16:22:49Z","messageCount":3,"participants":["John Keeping","Johannes Schindelin"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"213279","messageId":"a6f8377623599ef8f31cc63f7e038b5e8d04aa01.1365177990.git.john@keeping.me.uk","threadId":"33395","inReplyTo":null,"subject":"[PATCH] submodule: print graph output next to submodule log","fromName":"John Keeping","fromEmail":"john@keeping.me.uk","sentAt":"2013-04-05T16:06:30Z","receivedAt":"2013-04-05T16:06:30Z","isPatch":true,"sender":{"key":"john@keeping.me.uk","avatar":"https://avatars.githubusercontent.com/u/1702081?v=4"},"body":"From: John Keeping <john@metanate.com>\n\nWhen running \"git log -p --submodule=log\", the submodule log is not\nindented by the graph output, although all other lines are.  Fix this by\nprepending the current line prefix to each line of the submodule log.\n\nSigned-off-by: John Keeping <john@keeping.me.uk>\n---\n diff.c      |  1 +\n submodule.c | 13 +++++++++----\n submodule.h |  1 +\n 3 files changed, 11 insertions(+), 4 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex db952a5..28a742c 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -2255,6 +2255,7 @@ static void builtin_diff(const char *name_a,\n \t\tconst char *del = diff_get_color_opt(o, DIFF_FILE_OLD);\n \t\tconst char *add = diff_get_color_opt(o, DIFF_FILE_NEW);\n \t\tshow_submodule_summary(o->file, one ? one->path : two->path,\n+\t\t\t\tline_prefix,\n \t\t\t\tone->sha1, two->sha1, two->dirty_submodule,\n \t\t\t\tmeta, del, add, reset);\n \t\treturn;\ndiff --git a/submodule.c b/submodule.c\nindex 975bc87..e728025 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -216,6 +216,7 @@ static int prepare_submodule_summary(struct rev_info *rev, const char *path,\n }\n \n static void print_submodule_summary(struct rev_info *rev, FILE *f,\n+\t\tconst char *line_prefix,\n \t\tconst char *del, const char *add, const char *reset)\n {\n \tstatic const char format[] = \"  %m %s\";\n@@ -226,6 +227,7 @@ static void print_submodule_summary(struct rev_info *rev, FILE *f,\n \t\tstruct pretty_print_context ctx = {0};\n \t\tctx.date_mode = rev->date_mode;\n \t\tstrbuf_setlen(&sb, 0);\n+\t\tstrbuf_addstr(&sb, line_prefix);\n \t\tif (commit->object.flags & SYMMETRIC_LEFT) {\n \t\t\tif (del)\n \t\t\t\tstrbuf_addstr(&sb, del);\n@@ -256,6 +258,7 @@ int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg)\n }\n \n void show_submodule_summary(FILE *f, const char *path,\n+\t\tconst char *line_prefix,\n \t\tunsigned char one[20], unsigned char two[20],\n \t\tunsigned dirty_submodule, const char *meta,\n \t\tconst char *del, const char *add, const char *reset)\n@@ -280,16 +283,18 @@ void show_submodule_summary(FILE *f, const char *path,\n \t\tmessage = \"(revision walker failed)\";\n \n \tif (dirty_submodule & DIRTY_SUBMODULE_UNTRACKED)\n-\t\tfprintf(f, \"Submodule %s contains untracked content\\n\", path);\n+\t\tfprintf(f, \"%sSubmodule %s contains untracked content\\n\",\n+\t\t\tline_prefix, path);\n \tif (dirty_submodule & DIRTY_SUBMODULE_MODIFIED)\n-\t\tfprintf(f, \"Submodule %s contains modified content\\n\", path);\n+\t\tfprintf(f, \"%sSubmodule %s contains modified content\\n\",\n+\t\t\tline_prefix, path);\n \n \tif (!hashcmp(one, two)) {\n \t\tstrbuf_release(&sb);\n \t\treturn;\n \t}\n \n-\tstrbuf_addf(&sb, \"%sSubmodule %s %s..\", meta, path,\n+\tstrbuf_addf(&sb, \"%s%sSubmodule %s %s..\", line_prefix, meta, path,\n \t\t\tfind_unique_abbrev(one, DEFAULT_ABBREV));\n \tif (!fast_backward && !fast_forward)\n \t\tstrbuf_addch(&sb, '.');\n@@ -301,7 +306,7 @@ void show_submodule_summary(FILE *f, const char *path,\n \tfwrite(sb.buf, sb.len, 1, f);\n \n \tif (!message) /* only NULL if we succeeded in setting up the walk */\n-\t\tprint_submodule_summary(&rev, f, del, add, reset);\n+\t\tprint_submodule_summary(&rev, f, line_prefix, del, add, reset);\n \tif (left)\n \t\tclear_commit_marks(left, ~0);\n \tif (right)\ndiff --git a/submodule.h b/submodule.h\nindex 3dc1b3f..c7ffc7c 100644\n--- a/submodule.h\n+++ b/submodule.h\n@@ -19,6 +19,7 @@ int parse_submodule_config_option(const char *var, const char *value);\n void handle_ignore_submodules_arg(struct diff_options *diffopt, const char *);\n int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg);\n void show_submodule_summary(FILE *f, const char *path,\n+\t\tconst char *line_prefix,\n \t\tunsigned char one[20], unsigned char two[20],\n \t\tunsigned dirty_submodule, const char *meta,\n \t\tconst char *del, const char *add, const char *reset);\n-- \n1.8.2.452.gb520e27\n"},{"id":"213278","messageId":"20130405161207.GQ2222@serenity.lan","threadId":"33395","inReplyTo":"a6f8377623599ef8f31cc63f7e038b5e8d04aa01.1365177990.git.john@keeping.me.uk","subject":"[PATCH v2] submodule: print graph output next to submodule log","fromName":"John Keeping","fromEmail":"john@keeping.me.uk","sentAt":"2013-04-05T16:12:08Z","receivedAt":"2013-04-05T16:12:08Z","isPatch":true,"sender":{"key":"john@keeping.me.uk","avatar":"https://avatars.githubusercontent.com/u/1702081?v=4"},"body":"When running \"git log -p --submodule=log\", the submodule log is not\nindented by the graph output, although all other lines are.  Fix this by\nprepending the current line prefix to each line of the submodule log.\n\nSigned-off-by: John Keeping <john@keeping.me.uk>\n---\nOn Fri, Apr 05, 2013 at 05:06:30PM +0100, John Keeping wrote:\n> From: John Keeping <john@metanate.com>\n\nThat shouldn't have escaped here :-(  The email in the S-O-B is the\nright one.\n\nNo other change from v1.\n\n diff.c      |  1 +\n submodule.c | 13 +++++++++----\n submodule.h |  1 +\n 3 files changed, 11 insertions(+), 4 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex db952a5..28a742c 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -2255,6 +2255,7 @@ static void builtin_diff(const char *name_a,\n \t\tconst char *del = diff_get_color_opt(o, DIFF_FILE_OLD);\n \t\tconst char *add = diff_get_color_opt(o, DIFF_FILE_NEW);\n \t\tshow_submodule_summary(o->file, one ? one->path : two->path,\n+\t\t\t\tline_prefix,\n \t\t\t\tone->sha1, two->sha1, two->dirty_submodule,\n \t\t\t\tmeta, del, add, reset);\n \t\treturn;\ndiff --git a/submodule.c b/submodule.c\nindex 975bc87..e728025 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -216,6 +216,7 @@ static int prepare_submodule_summary(struct rev_info *rev, const char *path,\n }\n \n static void print_submodule_summary(struct rev_info *rev, FILE *f,\n+\t\tconst char *line_prefix,\n \t\tconst char *del, const char *add, const char *reset)\n {\n \tstatic const char format[] = \"  %m %s\";\n@@ -226,6 +227,7 @@ static void print_submodule_summary(struct rev_info *rev, FILE *f,\n \t\tstruct pretty_print_context ctx = {0};\n \t\tctx.date_mode = rev->date_mode;\n \t\tstrbuf_setlen(&sb, 0);\n+\t\tstrbuf_addstr(&sb, line_prefix);\n \t\tif (commit->object.flags & SYMMETRIC_LEFT) {\n \t\t\tif (del)\n \t\t\t\tstrbuf_addstr(&sb, del);\n@@ -256,6 +258,7 @@ int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg)\n }\n \n void show_submodule_summary(FILE *f, const char *path,\n+\t\tconst char *line_prefix,\n \t\tunsigned char one[20], unsigned char two[20],\n \t\tunsigned dirty_submodule, const char *meta,\n \t\tconst char *del, const char *add, const char *reset)\n@@ -280,16 +283,18 @@ void show_submodule_summary(FILE *f, const char *path,\n \t\tmessage = \"(revision walker failed)\";\n \n \tif (dirty_submodule & DIRTY_SUBMODULE_UNTRACKED)\n-\t\tfprintf(f, \"Submodule %s contains untracked content\\n\", path);\n+\t\tfprintf(f, \"%sSubmodule %s contains untracked content\\n\",\n+\t\t\tline_prefix, path);\n \tif (dirty_submodule & DIRTY_SUBMODULE_MODIFIED)\n-\t\tfprintf(f, \"Submodule %s contains modified content\\n\", path);\n+\t\tfprintf(f, \"%sSubmodule %s contains modified content\\n\",\n+\t\t\tline_prefix, path);\n \n \tif (!hashcmp(one, two)) {\n \t\tstrbuf_release(&sb);\n \t\treturn;\n \t}\n \n-\tstrbuf_addf(&sb, \"%sSubmodule %s %s..\", meta, path,\n+\tstrbuf_addf(&sb, \"%s%sSubmodule %s %s..\", line_prefix, meta, path,\n \t\t\tfind_unique_abbrev(one, DEFAULT_ABBREV));\n \tif (!fast_backward && !fast_forward)\n \t\tstrbuf_addch(&sb, '.');\n@@ -301,7 +306,7 @@ void show_submodule_summary(FILE *f, const char *path,\n \tfwrite(sb.buf, sb.len, 1, f);\n \n \tif (!message) /* only NULL if we succeeded in setting up the walk */\n-\t\tprint_submodule_summary(&rev, f, del, add, reset);\n+\t\tprint_submodule_summary(&rev, f, line_prefix, del, add, reset);\n \tif (left)\n \t\tclear_commit_marks(left, ~0);\n \tif (right)\ndiff --git a/submodule.h b/submodule.h\nindex 3dc1b3f..c7ffc7c 100644\n--- a/submodule.h\n+++ b/submodule.h\n@@ -19,6 +19,7 @@ int parse_submodule_config_option(const char *var, const char *value);\n void handle_ignore_submodules_arg(struct diff_options *diffopt, const char *);\n int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg);\n void show_submodule_summary(FILE *f, const char *path,\n+\t\tconst char *line_prefix,\n \t\tunsigned char one[20], unsigned char two[20],\n \t\tunsigned dirty_submodule, const char *meta,\n \t\tconst char *del, const char *add, const char *reset);\n-- \n1.8.2.452.gb520e27\n"},{"id":"213283","messageId":"alpine.DEB.1.00.1304051822100.1863@s15462909.onlinehome-server.info","threadId":"33395","inReplyTo":"20130405161207.GQ2222@serenity.lan","subject":"Re: [PATCH v2] submodule: print graph output next to submodule log","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2013-04-05T16:22:49Z","receivedAt":"2013-04-05T16:22:49Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi John,\n\nOn Fri, 5 Apr 2013, John Keeping wrote:\n\n> When running \"git log -p --submodule=log\", the submodule log is not\n> indented by the graph output, although all other lines are.  Fix this by\n> prepending the current line prefix to each line of the submodule log.\n\nNice! I agree that submodules are an ugly child of Git; not even Git\nitself uses them ;-)\n\nThanks for that fix!\n\nCiao,\nDscho\n"}]}