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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All places which call interpolate() get this interpolation for free.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@xxxxxx>

---

	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)
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux