threads / discuss / 1458

Make git-rev-tree obsolete

Subject: Make git-rev-tree obsolete

## tl;dr

6 messages between Aug 9, 2005 and Aug 11, 2005.

replies: 5people: 5as markdown or json

Johannes Schindelin· Aug 9, 2005, 00:23 UTC · lore
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· Aug 9, 2005, 02:09 UTC · re: Johannes Schindelin · lore

Re: Make git-rev-tree obsolete

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).

Show 19 quoted lines
> --- 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· Aug 9, 2005, 02:49 UTC · re: Johannes Schindelin · lore

Re: Make git-rev-tree obsolete

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· Aug 9, 2005, 04:48 UTC · re: Junio C Hamano · lore

Re: Make git-rev-tree obsolete

On Mon, Aug 08, 2005 at 07:49:26PM -0700, Junio C Hamano wrote:
Show 8 quoted lines
> 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· Aug 9, 2005, 10:18 UTC · re: Junio C Hamano · lore

Re: Make git-rev-tree obsolete

Hi,
On Mon, 8 Aug 2005, Junio C Hamano wrote:
Show 8 quoted lines
> 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· Aug 11, 2005, 22:22 UTC · re: Junio C Hamano · lore

Re: Make git-rev-tree obsolete

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...

Show 8 quoted lines
> 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

← back to recent threads