Re: [PATCH 3/3] diffstat generation in hooks--update was passing "^baserev" to git-diff-tree

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

 




On Tue, 13 Feb 2007, Andy Parkins wrote:
>
> -			echo "Diffstat:"
> -			git-diff-tree --no-color --stat -M -C --find-copies-harder $newrev ^$baserev
> +			echo "Diffstat against $baserev:"
> +			git-diff-tree --no-color --stat -M -C --find-copies-harder $newrev $baserev

This is wrong.

	newrev ^baserev

is right. The "not baserev" tells diff-tree that the baserev is the 
starting point, so newrev is obviously the target, and thus that will 
generate a diff from baserev to newrev.

So will either of

	baserev..newrev
	baserev newrev

which mean _exactly_ the same thing as "newrev ^basrev" to "diff-tree", 
because in all cases it's obviously "baserev" that is the old one to diff 
against.

But

	newrev baserev

means the diff from "new" to "base", which is exactly the wrong way 
around.

Of course, since we did

	baserev=$(git-merge-base $oldrev $newrev)

to generate base-rev, we could actually have done

	$oldrev...$newrev

(note the _three_ dots) which means "diff from merge-base to newrev". But 
since we use "baserev" multiple times, what the update hook does right now 
is actually better - it avoids the cost of re-computing the merge base 
that we needed for other things anyway.

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