On Fri, May 25, 2018 at 11:00 PM, Martin Ågren <martin.agren@xxxxxxxxx> wrote: > advice.c contains a useful code snippet which takes a multi-line string > and prints the lines, prefixing and suffixing each line with two > constant strings. This was originally added in 23cb5bf3b3 (i18n of > multi-line advice messages, 2011-12-22) to produce such output: > > hint: some multi-line advice > hint: prefixed with "hint: " > > The prefix is actually colored after 960786e761 (push: colorize errors, > 2018-04-21) and each line has a suffix for resetting the color. > > The next commit will teach the same "prefix all the lines"-trick to the > code that produces, e.g., "warning: "-messages. In preparation for that, > extract the code for printing the individual lines and expose it through > git-compat-util.h. > > Signed-off-by: Martin Ågren <martin.agren@xxxxxxxxx> > --- > I'm open for suggestions on the naming of `prefix_suffix_lines()`... I think the important verb, print (to FILE*), is somehow missing. This current name would be great if it produces another str(buf). -- Duy