On Tue, 9 Aug 2005, John Ellson wrote:
>
> I hacked this:
>
> #!/bin/bash
> ID=`git-ls-files -s | grep $1 | cut -d ' ' -f 2`
No. "git-ls-files" shows the latest _index_ state, not the latest
committed state.
Use "git-ls-tree HEAD pathname" to get the latest committed state for the
pathname, and then pick out the SHA1 from there, use
git-cat-file blob <sha1>
to cat the result.
Of course, this will work with any revision, not just HEAD. So you could
do something like
git-ls-tree $(git-rev-parse --default HEAD "$@") |
while read mode type sha name
do
case "$type" in
blob)
git-cat-file blob "$sha"
;;
tree)
git-ls-tree "$sha"
;;
*)
exit 1
done
(totally untested)
Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html