submodule: print graph output next to submodule log
PATCH 1/1 submodule: print graph output next to submodule log
From: John Keeping <[email protected]>
When running "git log -p --submodule=log", the submodule log is not indented by the graph output, although all other lines are. Fix this by prepending the current line prefix to each line of the submodule log.
--- diff.c | 1 + submodule.c | 13 +++++++++---- submodule.h | 1 + 3 files changed, 11 insertions(+), 4 deletions(-)
diff.c +1 -0
@@ -2255,6 +2255,7 @@ static void builtin_diff(const char *name_a,const char *del =diff_get_color_opt (o,DIFF_FILE_OLD );const char *add =diff_get_color_opt (o,DIFF_FILE_NEW );show_submodule_summary (o->file, one ? one->path : two->path, + line_prefix, one->sha1, two->sha1, two->dirty_submodule, meta, del, add, reset);return ;
submodule.c +9 -4
@@ -216,6 +216,7 @@ static int prepare_submodule_summary(struct rev_info *rev, const char *path, }static void print_submodule_summary (struct rev_info *rev,FILE *f, +const char *line_prefix,const char *del,const char *add,const char *reset) {static const char format[] =" %m %s" ;
@@ -226,6 +227,7 @@ static void print_submodule_summary(struct rev_info *rev, FILE *f,struct pretty_print_context ctx = {0 }; ctx.date_mode = rev->date_mode;strbuf_setlen (&sb,0 ); +strbuf_addstr (&sb, line_prefix);if (commit->object.flags &SYMMETRIC_LEFT ) {if (del)strbuf_addstr (&sb, del);
@@ -256,6 +258,7 @@ int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg) }void show_submodule_summary (FILE *f,const char *path, +const char *line_prefix,unsigned char one[20 ],unsigned char two[20 ],unsigned dirty_submodule,const char *meta,const char *del,const char *add,const char *reset)
@@ -280,16 +283,18 @@ void show_submodule_summary(FILE *f, const char *path, message ="(revision walker failed)" ;if (dirty_submodule &DIRTY_SUBMODULE_UNTRACKED ) -fprintf (f,"Submodule %s contains untracked content\n" , path); +fprintf (f,"%sSubmodule %s contains untracked content\n" , + line_prefix, path);if (dirty_submodule &DIRTY_SUBMODULE_MODIFIED ) -fprintf (f,"Submodule %s contains modified content\n" , path); +fprintf (f,"%sSubmodule %s contains modified content\n" , + line_prefix, path);if (!hashcmp (one, two)) {strbuf_release (&sb);return ; } -strbuf_addf (&sb,"%sSubmodule %s %s.." , meta, path, +strbuf_addf (&sb,"%s%sSubmodule %s %s.." , line_prefix, meta, path,find_unique_abbrev (one,DEFAULT_ABBREV ));if (!fast_backward && !fast_forward)strbuf_addch (&sb,'.' );
@@ -301,7 +306,7 @@ void show_submodule_summary(FILE *f, const char *path,fwrite (sb.buf, sb.len,1 , f);if (!message)/* only NULL if we succeeded in setting up the walk */ -print_submodule_summary (&rev, f, del, add, reset); +print_submodule_summary (&rev, f, line_prefix, del, add, reset);if (left)clear_commit_marks (left, ~0 );if (right)
submodule.h +1 -0
@@ -19,6 +19,7 @@ int parse_submodule_config_option(const char *var, const char *value);void handle_ignore_submodules_arg (struct diff_options *diffopt,const char *);int parse_fetch_recurse_submodules_arg (const char *opt,const char *arg);void show_submodule_summary (FILE *f,const char *path, +const char *line_prefix,unsigned char one[20 ],unsigned char two[20 ],unsigned dirty_submodule,const char *meta,const char *del,const char *add,const char *reset);
Signature · 1 line
1.8.2.452.gb520e27
PATCH v2 1/1 submodule: print graph output next to submodule log
When running "git log -p --submodule=log", the submodule log is not indented by the graph output, although all other lines are. Fix this by prepending the current line prefix to each line of the submodule log.
---
Quoted 1 line · John Keeping
From: John Keeping <[email protected]>
That shouldn't have escaped here :-( The email in the S-O-B is the right one.
No other change from v1.
diff.c | 1 + submodule.c | 13 +++++++++---- submodule.h | 1 + 3 files changed, 11 insertions(+), 4 deletions(-)
diff.c +1 -0
@@ -2255,6 +2255,7 @@ static void builtin_diff(const char *name_a,const char *del =diff_get_color_opt (o,DIFF_FILE_OLD );const char *add =diff_get_color_opt (o,DIFF_FILE_NEW );show_submodule_summary (o->file, one ? one->path : two->path, + line_prefix, one->sha1, two->sha1, two->dirty_submodule, meta, del, add, reset);return ;
submodule.c +9 -4
@@ -216,6 +216,7 @@ static int prepare_submodule_summary(struct rev_info *rev, const char *path, }static void print_submodule_summary (struct rev_info *rev,FILE *f, +const char *line_prefix,const char *del,const char *add,const char *reset) {static const char format[] =" %m %s" ;
@@ -226,6 +227,7 @@ static void print_submodule_summary(struct rev_info *rev, FILE *f,struct pretty_print_context ctx = {0 }; ctx.date_mode = rev->date_mode;strbuf_setlen (&sb,0 ); +strbuf_addstr (&sb, line_prefix);if (commit->object.flags &SYMMETRIC_LEFT ) {if (del)strbuf_addstr (&sb, del);
@@ -256,6 +258,7 @@ int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg) }void show_submodule_summary (FILE *f,const char *path, +const char *line_prefix,unsigned char one[20 ],unsigned char two[20 ],unsigned dirty_submodule,const char *meta,const char *del,const char *add,const char *reset)
@@ -280,16 +283,18 @@ void show_submodule_summary(FILE *f, const char *path, message ="(revision walker failed)" ;if (dirty_submodule &DIRTY_SUBMODULE_UNTRACKED ) -fprintf (f,"Submodule %s contains untracked content\n" , path); +fprintf (f,"%sSubmodule %s contains untracked content\n" , + line_prefix, path);if (dirty_submodule &DIRTY_SUBMODULE_MODIFIED ) -fprintf (f,"Submodule %s contains modified content\n" , path); +fprintf (f,"%sSubmodule %s contains modified content\n" , + line_prefix, path);if (!hashcmp (one, two)) {strbuf_release (&sb);return ; } -strbuf_addf (&sb,"%sSubmodule %s %s.." , meta, path, +strbuf_addf (&sb,"%s%sSubmodule %s %s.." , line_prefix, meta, path,find_unique_abbrev (one,DEFAULT_ABBREV ));if (!fast_backward && !fast_forward)strbuf_addch (&sb,'.' );
@@ -301,7 +306,7 @@ void show_submodule_summary(FILE *f, const char *path,fwrite (sb.buf, sb.len,1 , f);if (!message)/* only NULL if we succeeded in setting up the walk */ -print_submodule_summary (&rev, f, del, add, reset); +print_submodule_summary (&rev, f, line_prefix, del, add, reset);if (left)clear_commit_marks (left, ~0 );if (right)
submodule.h +1 -0
@@ -19,6 +19,7 @@ int parse_submodule_config_option(const char *var, const char *value);void handle_ignore_submodules_arg (struct diff_options *diffopt,const char *);int parse_fetch_recurse_submodules_arg (const char *opt,const char *arg);void show_submodule_summary (FILE *f,const char *path, +const char *line_prefix,unsigned char one[20 ],unsigned char two[20 ],unsigned dirty_submodule,const char *meta,const char *del,const char *add,const char *reset);
Signature · 1 line
1.8.2.452.gb520e27
Hi John,
Quoted 3 lines · John Keeping
When running "git log -p --submodule=log", the submodule log is not indented by the graph output, although all other lines are. Fix this by prepending the current line prefix to each line of the submodule log.
Nice! I agree that submodules are an ugly child of Git; not even Git itself uses them ;-)
Thanks for that fix!
Ciao,
Dscho