Subject: Re: [VALGRIND PATCH for nth_last patch series] Fix invalid memory access

From: Thomas Rast <[email-masked]>
Date: Wed, 21 Jan 2009 10:18:57 +0100

Junio C Hamano wrote:
> We only accept "checkout: moving from A to B" newer style reflog entries,
> in order to pick up A.  There is no point computing where B begins at
> after running strstr to locate " to ", nor adding 4 and then subtracting 4
> from the same pointer.
[...]
> -	len = target - match - 4;
> -	if (target[len] == '\n' && !strncmp(match, target, len))
> -		return 0;
> -
> +	len = target - match;

Actually the point of that exercise was to ignore branch (non)switches
of the form

  checkout: moving from A to A

I originally thought that this would be desirable behaviour, but now
that it causes so much trouble, I'm not that sure any more.  I still
think it would be more intuitive to not count them as switches (after
all git-checkout says 'Already on "$branch"'), but OTOH 'cd .; cd -'
also stays in the same directory.

Thanks for all the work you (both) are doing on this.  I hope to find
the time to read the current state of the series tonight.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch