git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Trim ending whitespaces in exclude file if needed.
@ 2010-10-15 22:41 Vasyl'
  2010-10-17  2:41 ` Jonathan Nieder
  0 siblings, 1 reply; 4+ messages in thread
From: Vasyl' @ 2010-10-15 22:41 UTC (permalink / raw)
  To: git; +Cc: vvavrychuk

Signed-off-by: Vasyl' Vavrychuk <vvavrychuk@gmail.com>
---

Hope this can save someone's time debugging git.

 dir.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dir.c b/dir.c
index d1e5e5e..704914b 100644
--- a/dir.c
+++ b/dir.c
@@ -171,7 +171,15 @@ void add_exclude(const char *string, const char *base,
 		to_exclude = 0;
 		string++;
 	}
+
 	len = strlen(string);
+	if (len && isspace((unsigned char)string[len - 1])) {
+		struct strbuf trim_buf = STRBUF_INIT;
+		strbuf_add(&trim_buf, string, len);
+		strbuf_rtrim(&trim_buf);
+		string = strbuf_detach(&trim_buf, &len);
+	}
+
 	if (len && string[len - 1] == '/') {
 		char *s;
 		x = xmalloc(sizeof(*x) + len);
-- 
1.7.3.1.msysgit.0

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

end of thread, other threads:[~2010-10-18 21:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-15 22:41 [PATCH] Trim ending whitespaces in exclude file if needed Vasyl'
2010-10-17  2:41 ` Jonathan Nieder
2010-10-17  9:29   ` Vasyl'
2010-10-18 21:54     ` 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).