From: Jonathan Nieder <jrnieder@gmail.com>
To: Vasyl' <vvavrychuk@gmail.com>
Cc: git@vger.kernel.org, msysgit@googlegroups.com
Subject: Re: [PATCH] Trim ending whitespaces in exclude file if needed.
Date: Sat, 16 Oct 2010 21:41:33 -0500 [thread overview]
Message-ID: <20101017024133.GF26656@burratino> (raw)
In-Reply-To: <AANLkTinUHQzuLJhZnVMKngEO75W=+5sES0WZFAFw5bDw@mail.gmail.com>
(+cc: msysgit)
Vasyl' wrote:
> Hope this can save someone's time debugging git.
It sounds like there's a story behind this one. Could you tell it?
That would help future readers of this code to easily determine
why they shouldn't break it.
> --- a/dir.c
> +++ b/dir.c
> @@ -171,7 +171,15 @@ void add_exclude(const char *string, const char *base,
> to_exclude = 0;
> string++;
> }
> +
Why?
> len = strlen(string);
> + if (len && isspace((unsigned char)string[len - 1])) {
This cast is not needed (see git-compat-util.h).
> + struct strbuf trim_buf = STRBUF_INIT;
> + strbuf_add(&trim_buf, string, len);
> + strbuf_rtrim(&trim_buf);
Missing free(string)?
> + string = strbuf_detach(&trim_buf, &len);
> + }
> +
> if (len && string[len - 1] == '/') {
Thanks for a clear and pleasant read.
Jonathan
next prev parent reply other threads:[~2010-10-17 2:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-15 22:41 [PATCH] Trim ending whitespaces in exclude file if needed Vasyl'
2010-10-17 2:41 ` Jonathan Nieder [this message]
2010-10-17 9:29 ` Vasyl'
2010-10-18 21:54 ` 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=20101017024133.GF26656@burratino \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=msysgit@googlegroups.com \
--cc=vvavrychuk@gmail.com \
/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).