Re: What's in git.git, and announcing GIT 1.4.2-rc4

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

 



Hi,

On Thu, 10 Aug 2006, Junio C Hamano wrote:

> I tried it [--color-words] on this:
> 
> diff --git a/builtin-apply.c b/builtin-apply.c
> index c159873..be2c715 100644
> --- a/builtin-apply.c
> +++ b/builtin-apply.c
> @@ -1700,10 +1700,8 @@ static int apply_data(struct patch *patc
>  		return -1;
>  
>  	/* NUL terminate the result */
> -	if (desc.alloc <= desc.size) {
> +	if (desc.alloc <= desc.size)
>  		desc.buffer = xrealloc(desc.buffer, desc.size + 1);
> -		desc.alloc++;
> -	}
>  	desc.buffer[desc.size] = 0;
>  
>  	patch->result = desc.buffer;
> 
> which shows something like:
> 
> diff --git a/builtin-apply.c b/builtin-apply.c
> index c159873..be2c715 100644
> --- a/builtin-apply.c
> +++ b/builtin-apply.c
> @@ -1700,10 +1700,8 @@ static int apply_data(struct patch *patc
>                 return -1;
> 
>         /* NUL terminate the result */
>         if (desc.alloc <= desc.size)
> {
>                 desc.buffer = xrealloc(desc.buffer, desc.size + 1);
>                 desc.alloc++;
>         }
>         desc.buffer[desc.size] = 0;
> 
>         patch->result = desc.buffer;
> 
> where "desc.alloc++;" and next lines and the opening brace after
> if() are red.  Why does that red opening brace have to come at
> the beginning of line, I wonder...

It is an implementation detail: to determine the differing words, I turn 
all whitespace into newlines in that particular hunk, and then run another 
diff (nested diff run!). So, the space in --- and the newline in +++ 
compare equal. Since wI am mostly interested in the _new_ (gree) version, 
the newline is printed, not the space.

Hmmm. I have to think about it.

Ciao,
Dscho

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