Subject: Re: Newbie question: equiv of: cvs co -p <filename> ?

From: Rene Scharfe <[email-masked]>
Date: Wed, 10 Aug 2005 00:18:42 +0200

Johannes Schindelin wrote:
> On Tue, 9 Aug 2005, John Ellson wrote:
>>How can we cat the latest committed state of a file to stdout?
>>
>>I hacked this:
>>
>>	#!/bin/bash
>>	ID=`git-ls-files -s | grep $1 | cut -d ' ' -f 2`
> 
> 
> and now:
> 
> 	git-cat-file blob $ID

Still not pretty.  How about this?

	#!/bin/sh
	git-ls-tree HEAD "$@" | while read mode type hash filename; do
		[ "$type" = "blob" ] && git-cat-file blob "$hash"
	done

Rene