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

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

 



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