{"thread":{"id":"8903","subject":"[RFC/PATCH] interpolate '\\n' as newline","startedAt":"2007-07-06T20:02:00Z","lastAt":"2007-07-07T02:13:46Z","messageCount":2,"participants":["Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"46657","messageId":"Pine.LNX.4.64.0707062100360.4093@racer.site","threadId":"8903","inReplyTo":null,"subject":"[RFC/PATCH] interpolate '\\n' as newline","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-06T20:02:00Z","receivedAt":"2007-07-06T20:02:00Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nAll places which call interpolate() get this interpolation for free.\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n---\n\n\tIn the back of my head, I remembered that a few people\n\twere interested in this.\n\n\tJudging by the diffstat, it really escapes me why these people\n\tdid not implement it.\n\n\tHowever, there is a chance that this change is not liked by\n\tall places that call interpolate(). merge-recursive can live\n\twith it, I guess. But daemon interpolates the path... However,\n\tit seems only the command line of daemon can change the string,\n\tso this change should be safe. There is only one other place in \n\tgit.git, the --pretty=format: stuff, and that is where the idea\n\twas born first.\n\n interpolate.c |    6 ++++++\n 1 files changed, 6 insertions(+), 0 deletions(-)\n\ndiff --git a/interpolate.c b/interpolate.c\nindex 0082677..b322503 100644\n--- a/interpolate.c\n+++ b/interpolate.c\n@@ -87,6 +87,12 @@ unsigned long interpolate(char *result, unsigned long reslen,\n \t\t\t\tsrc += namelen;\n \t\t\t\tcontinue;\n \t\t\t}\n+\t\t} else if (c == '\\\\' && src[1] == 'n') {\n+\t\t\tif (newlen + 1 < reslen)\n+\t\t\t\t*dest++ = '\\n';\n+\t\t\tsrc += 2;\n+\t\t\tnewlen++;\n+\t\t\tcontinue;\n \t\t}\n \t\t/* Straight copy one non-interpolation character. */\n \t\tif (newlen + 1 < reslen)\n"},{"id":"46671","messageId":"7vy7htc65h.fsf@assigned-by-dhcp.cox.net","threadId":"8903","inReplyTo":"Pine.LNX.4.64.0707062100360.4093@racer.site","subject":"Re: [RFC/PATCH] interpolate '\\n' as newline","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-07T02:13:46Z","receivedAt":"2007-07-07T02:13:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> All places which call interpolate() get this interpolation for free.\n>\n> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n>\n> ---\n>\n> \tIn the back of my head, I remembered that a few people\n> \twere interested in this.\n>\n> \tJudging by the diffstat, it really escapes me why these people\n> \tdid not implement it.\n>\n> \tHowever, there is a chance that this change is not liked by\n> \tall places that call interpolate(). merge-recursive can live\n> \twith it, I guess.\n\nI actually think merge-recursive has much bigger chance of\ngetting broken than git-daemon, but only _if_ people are already\nusing custom merge programs this becomes an issue.  It is much\nmore common to see two letter sequence '\\n' as a string literal\nin a script than in a pathname.\n\n>       But daemon interpolates the path... However,\n> \tit seems only the command line of daemon can change the string,\n> \tso this change should be safe.\n\nThe command line needs to say --interpolated-path=\"...\\n...\"\nand expect that '\\n' would come out as two characters backslash\nand en in the _pathname_ to get broken, and it is very unlikely\nthat anybody is insane enough to have such a path.\n"}]}