# Make git-rev-tree obsolete

6 messages from 2005-08-09 to 2005-08-11. Participants: Johannes Schindelin, Linus Torvalds, Junio C Hamano, Jeff Garzik, Petr Baudis.
Thread: https://gitlist.dev/t/1458

## Johannes Schindelin, 2005-08-09 00:23

Subject: Make git-rev-tree obsolete
Message-ID: <Pine.LNX.4.63.0508090222190.4076@wgmdd8.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0508090222190.4076%40wgmdd8.biozentrum.uni-wuerzburg.de

```
Hi,

Junio remarked that Jeff's git-changes-script still uses git-rev-tree, and 
therefore it should not be removed. This patch changes git-changes-script 
over to git-rev-list:

--- git-changes-script.orig	Tue Aug  9 02:21:36 2005
+++ git-changes-script	Tue Aug  9 02:20:53 2005
@@ -85,14 +85,14 @@
 	base=$(cat .git/HEAD) || exit 1
 fi
 
-git-rev-tree $base | sort -rn  > ${tmpfile}.base
+git-rev-list $base > ${tmpfile}.base
 if [ -n "$remote" ]; then
 	[ -d $remote/.git ] || exit 1
 	if [ -z "$tobase" ]; then
 		tobase=$(cat $remote/.git/HEAD) || exit 1
 	fi
 	pushd $remote > /dev/null
-	git-rev-tree $tobase | sort -rn > ${tmpfile}.remote
+	git-rev-list $tobase > ${tmpfile}.remote
 	diff -u ${tmpfile}.base ${tmpfile}.remote | grep "^${diffsearch}[^${diffsearch}]" | cut -c 1- > ${tmpfile}.diff
 	rm -f ${tmpfile}.base ${tmpfile}.remote
 	mv ${tmpfile}.diff ${tmpfile}.base
@@ -103,7 +103,7 @@
 
 [ -s "${tmpfile}.base" ] || exit 0
 
-cat ${tmpfile}.base | while read time commit parents; do
+cat ${tmpfile}.base | while read commit; do
 	showcommit $commit
 	echo -e "\n--------------------------"
 

```

## Linus Torvalds, 2005-08-09 02:09

Subject: Re: Make git-rev-tree obsolete
Message-ID: <Pine.LNX.4.58.0508081858120.3258@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.58.0508081858120.3258%40g5.osdl.org
In-Reply-To: <Pine.LNX.4.63.0508090222190.4076@wgmdd8.biozentrum.uni-wuerzburg.de>

```


On Tue, 9 Aug 2005, Johannes Schindelin wrote:
> 
> Junio remarked that Jeff's git-changes-script still uses git-rev-tree, and 
> therefore it should not be removed. This patch changes git-changes-script 
> over to git-rev-list:

It really should be totally rewritten, to take advantage of git-rev-list 
being able to terminate early. As it is, your conversion may work, and it 
may give the right results, but it will suck performance-wise for all the 
same reasons that git-rev-tree sucked: it will walk all the way down to 
the root of the tree(s).

> --- git-changes-script.orig	Tue Aug  9 02:21:36 2005
> +++ git-changes-script	Tue Aug  9 02:20:53 2005
> @@ -85,14 +85,14 @@
>  	base=$(cat .git/HEAD) || exit 1
>  fi
>  
> -git-rev-tree $base | sort -rn  > ${tmpfile}.base
> +git-rev-list $base > ${tmpfile}.base
>  if [ -n "$remote" ]; then
>  	[ -d $remote/.git ] || exit 1
>  	if [ -z "$tobase" ]; then
>  		tobase=$(cat $remote/.git/HEAD) || exit 1
>  	fi
>  	pushd $remote > /dev/null
> -	git-rev-tree $tobase | sort -rn > ${tmpfile}.remote
> +	git-rev-list $tobase > ${tmpfile}.remote
>  	diff -u ${tmpfile}.base ${tmpfile}.remote | grep "^${diffsearch}[^${diffsearch}]" | cut -c 1- > ${tmpfile}.diff
>  	rm -f ${tmpfile}.base ${tmpfile}.remote
>  	mv ${tmpfile}.diff ${tmpfile}.base

It really should do something like

	#
	# Make sure we see objects in the remote directory
	#
	export GIT_ALTERNATE_OBJECT_DIRECTORIES=$remote/.git/objects

	#
	# Get the local SHA1
	#
	local_ref=$(git-rev-parse --verify $base^0) || exit

	#
	# Get the remote SHA1
	#
	remote_ref=$(GIT_DIR="$remote/.git" git-rev-parse --verify $tobase^0) || exit

	#
	# Ok, let it rip..
	#
	git log $remote_ref..$local_ref

to do a proper search of objects that are in $local but not in $remote, 
without having to traverse all the way down to the root for both.

		Linus

```

## Junio C Hamano, 2005-08-09 02:49

Subject: Re: Make git-rev-tree obsolete
Message-ID: <7vhddzygcp.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vhddzygcp.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <Pine.LNX.4.63.0508090222190.4076@wgmdd8.biozentrum.uni-wuerzburg.de>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Junio remarked that Jeff's git-changes-script still uses git-rev-tree, and 
> therefore it should not be removed. This patch changes git-changes-script 
> over to git-rev-list:

Just to make things clear, "Junio remarked" that Cogito also
seems to use it as well, so git-rev-tree is not going away.

```

## Jeff Garzik, 2005-08-09 04:48

Subject: Re: Make git-rev-tree obsolete
Message-ID: <20050809044834.GA13404@havoc.gtf.org>
URL: https://gitlist.dev/e/20050809044834.GA13404%40havoc.gtf.org
In-Reply-To: <7vhddzygcp.fsf@assigned-by-dhcp.cox.net>

```
On Mon, Aug 08, 2005 at 07:49:26PM -0700, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > Junio remarked that Jeff's git-changes-script still uses git-rev-tree, and 
> > therefore it should not be removed. This patch changes git-changes-script 
> > over to git-rev-list:
> 
> Just to make things clear, "Junio remarked" that Cogito also
> seems to use it as well, so git-rev-tree is not going away.

git-changes-script is basically an old Cogito script, as you can see
from looking at the source code.

I only use it for

	cd /repos/misc-2.6
	git-changes-script -L ../linux-2.6

i.e. where there are two separate trees, rather than separate branches
that I normally work with.

	Jeff

```

## Johannes Schindelin, 2005-08-09 10:18

Subject: Re: Make git-rev-tree obsolete
Message-ID: <Pine.LNX.4.63.0508091218210.6752@wgmdd8.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0508091218210.6752%40wgmdd8.biozentrum.uni-wuerzburg.de
In-Reply-To: <7vhddzygcp.fsf@assigned-by-dhcp.cox.net>

```
Hi,

On Mon, 8 Aug 2005, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > Junio remarked that Jeff's git-changes-script still uses git-rev-tree, and 
> > therefore it should not be removed. This patch changes git-changes-script 
> > over to git-rev-list:
> 
> Just to make things clear, "Junio remarked" that Cogito also
> seems to use it as well, so git-rev-tree is not going away.

Oops! My bad.

```

## Petr Baudis, 2005-08-11 22:22

Subject: Re: Make git-rev-tree obsolete
Message-ID: <20050811222231.GH25280@pasky.ji.cz>
URL: https://gitlist.dev/e/20050811222231.GH25280%40pasky.ji.cz
In-Reply-To: <7vhddzygcp.fsf@assigned-by-dhcp.cox.net>

```
Dear diary, on Tue, Aug 09, 2005 at 04:49:26AM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> told me that...
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > Junio remarked that Jeff's git-changes-script still uses git-rev-tree, and 
> > therefore it should not be removed. This patch changes git-changes-script 
> > over to git-rev-list:
> 
> Just to make things clear, "Junio remarked" that Cogito also
> seems to use it as well, so git-rev-tree is not going away.

Please note

41283a6ed1924c7b3963c5455ba39911f1069682
	cg-mkpatch: Ditch git-rev-tree in favour of git-rev-list
7136aa4337334a28e55c8853018423d4b780214c
	cg-commit: Use git-rev-list instead of git-rev-tree

from 2005-08-05, which should remove any traces of git-rev-tree usage
from Cogito. Unfortunately, I did that only after releasing Cogito-0.13,
so you would break that particular version (first to depend on git
externally) by removing git-rev-tree now. But I think it's safe to kill
after a while (and another Cogito release, which shouldn't be far away).

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
If you want the holes in your knowledge showing up try teaching
someone.  -- Alan Cox

```
