[PATCH] Trim ending whitespaces in exclude file if needed.

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

 



Signed-off-by: Vasyl' Vavrychuk <vvavrychuk@xxxxxxxxx>
---

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
--
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]