From: Marco Costalba <mcostalba@gmail.com>
To: "Junio C Hamano" <junkio@cox.net>
Cc: "Git Mailing List" <git@vger.kernel.org>
Subject: [PATCH] Teach 'git-apply --whitespace=strip' to remove empty lines at end of file
Date: Sat, 19 May 2007 15:12:50 +0200 [thread overview]
Message-ID: <464EF7D2.4030406@gmail.com> (raw)
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
next reply other threads:[~2007-05-19 13:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-19 13:12 Marco Costalba [this message]
2007-05-19 20:39 ` [PATCH] Teach 'git-apply --whitespace=strip' to remove empty lines at end of file 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=464EF7D2.4030406@gmail.com \
--to=mcostalba@gmail.com \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).