git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Andy Parkins <andyparkins@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Fix mishandling of $Id$ expanded in the repository copy in convert.c
Date: Sat, 26 May 2007 01:09:45 -0700	[thread overview]
Message-ID: <7vlkfcm2eu.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <200705251150.09439.andyparkins@gmail.com> (Andy Parkins's message of "Fri, 25 May 2007 11:50:08 +0100")

Andy Parkins <andyparkins@gmail.com> writes:

> I've included the comments I wrote while debugging in this patch, which
> I'm sure will annoy you, because you'd rather the fix and the comments
> separately.  I'll supply that if you wish - just holler.

Actually I like well commented code, although some of your
comments feel a tad too much at places.  For example,

>  	for (dst = buf; size; size--) {
>  		const char *cp;
> +		/* Fetch next source character, move the pointer on */
>  		char ch = *src++;
> +		/* Copy the current character to the destination */
>  		*dst++ = ch;

These are too much.

> +		/* If the current character is "$" or there are less than three
> +		 * remaining bytes or the two bytes following this one are not
> +		 * "Id", then simply read the next character */
>  		if ((ch != '$') || (size < 3) || memcmp("Id", src, 2))
>  			continue;
> +		/*
> +		 * Here when
> +		 *  - There are more than 2 bytes remaining
> +		 *  - The current three bytes are "$Id$"
> +		 * with
> +		 *  - ch == "$"
> +		 *  - src[0] == "I"
> +		 */

But this is very good, if you fix it to read the current 3 are
"$Id" ;-).

> +		/*
> +		 * It's possible that an expanded Id has crept its way into the
> +		 * repository, we cope with that by stripping the expansion out
> +		 */

So are all the other comments.

Thanks for the fix.  It would be very nice for the patch to be
accompanied with a new test to expose the bug and demonstrate
that the patch fixes it.

  parent reply	other threads:[~2007-05-26  8:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-25 10:50 [PATCH] Fix mishandling of $Id$ expanded in the repository copy in convert.c Andy Parkins
2007-05-25 10:58 ` Joshua N Pritikin
2007-05-25 13:12   ` Andy Parkins
2007-05-25 13:13     ` [PATCH] Don't allow newlines to occur in $Id:$ collapse Andy Parkins
2007-05-25 13:28       ` Joshua N Pritikin
2007-05-25 13:47         ` Nicolas Pitre
2007-05-25 13:50         ` Andy Parkins
2007-05-25 14:40           ` Joshua N Pritikin
2007-05-26  8:09 ` Junio C Hamano [this message]
2007-05-26  9:12   ` [PATCH] Fix mishandling of $Id$ expanded in the repository copy in convert.c Andy Parkins
2007-05-26 19:05     ` Junio C Hamano
2007-05-27 10:50       ` Andy Parkins
2007-05-27 10:52         ` [PATCH] Add test case for $Id$ expanded in the repository Andy Parkins

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=7vlkfcm2eu.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=andyparkins@gmail.com \
    --cc=git@vger.kernel.org \
    /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).