Git Mailing List Archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-apply: do not fix whitespaces on context lines.
@ 2007-02-27  9:33 Junio C Hamano
  0 siblings, 0 replies; only message in thread
From: Junio C Hamano @ 2007-02-27  9:33 UTC (permalink / raw
  To: git

Internal function apply_line() is called to copy both context lines
and added lines to the output buffer, while possibly fixing the
whitespace breakages depending on --whitespace=strip settings.
However, it did its fix-up on both context lines and added lines.

This resulted in two symptoms:

 (1) The number of lines reported to have been fixed up included
     these context lines.

 (2) However, the lines actually shown were limited to the added
     lines that had whitespace breakages.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 builtin-apply.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/builtin-apply.c b/builtin-apply.c
index abe3538..bec95d6 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -1539,7 +1539,8 @@ static int apply_line(char *output, const char *patch, int plen)
 	int need_fix_leading_space = 0;
 	char *buf;
 
-	if ((new_whitespace != strip_whitespace) || !whitespace_error) {
+	if ((new_whitespace != strip_whitespace) || !whitespace_error ||
+	    *patch != '+') {
 		memcpy(output, patch + 1, plen);
 		return plen;
 	}
-- 
1.5.0.2.775.g1a500

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-02-27  9:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-27  9:33 [PATCH] git-apply: do not fix whitespaces on context lines Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).