git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC/PATCH] interpolate '\n' as newline

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 6, 2007, 20:02 UTC
Message-ID
<Pine.LNX.4.64.0707062100360.4093@racer.site>
All places which call interpolate() get this interpolation for free.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
	In the back of my head, I remembered that a few people
	were interested in this.
	Judging by the diffstat, it really escapes me why these people
	did not implement it.
	However, there is a chance that this change is not liked by
	all places that call interpolate(). merge-recursive can live
	with it, I guess. But daemon interpolates the path... However,
	it seems only the command line of daemon can change the string,
	so this change should be safe. There is only one other place in 
	git.git, the --pretty=format: stuff, and that is where the idea
	was born first.
 interpolate.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/interpolate.c b/interpolate.c
index 0082677..b322503 100644
--- a/interpolate.c
+++ b/interpolate.c
@@ -87,6 +87,12 @@ unsigned long interpolate(char *result, unsigned long reslen,
 				src += namelen;
 				continue;
 			}
+		} else if (c == '\\' && src[1] == 'n') {
+			if (newlen + 1 < reslen)
+				*dest++ = '\n';
+			src += 2;
+			newlen++;
+			continue;
 		}
 		/* Straight copy one non-interpolation character. */
 		if (newlen + 1 < reslen)
Next: Junio C Hamano
Message 1 of 2 in “interpolate '\n' as newline”
  1. interpolate '\n' as newlineJohannes Schindelin, Jul 6, 2007
  2. Junio C HamanoJul 7, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.