git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Teach 'git-apply --whitespace=strip' to remove empty lines at end of file
@ 2007-05-19 13:12 Marco Costalba
  2007-05-19 20:39 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Marco Costalba @ 2007-05-19 13:12 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
---
  builtin-apply.c |    4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/builtin-apply.c b/builtin-apply.c
index 0399743..f17f838 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -1738,6 +1738,10 @@ static int apply_one_fragment(struct buffer_desc *desc, struct fragment *frag, i
  		newsize--;
  	}

+	if (new_whitespace == strip_whitespace)
+		while (newsize > 1 && !strncmp(new + newsize - 2, "\n\n", 2))
+			newsize--;
+
  	oldlines = old;
  	newlines = new;
  	leading = frag->leading;
-- 
1.5.2.rc3.87.g404fd-dirty

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-05-19 23:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-19 13:12 [PATCH] Teach 'git-apply --whitespace=strip' to remove empty lines at end of file Marco Costalba
2007-05-19 20:39 ` Junio C Hamano
2007-05-19 21:58   ` Marco Costalba
2007-05-19 23:03     ` Junio C Hamano
2007-05-19 23:18       ` 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 NNTP newsgroup(s).