From: Uwe Zeisberger <zeisberg@informatik.uni-freiburg.de>
To: Junio C Hamano <junkio@cox.net>
Cc: Linus Torvalds <torvalds@osdl.org>, git@vger.kernel.org
Subject: Re: [RFC] get_sha1(): :path and :[0-3]:path to extract from index.
Date: Tue, 25 Apr 2006 10:37:24 +0200 [thread overview]
Message-ID: <20060425083724.GA1663@informatik.uni-freiburg.de> (raw)
In-Reply-To: <7v7j5iph7f.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
> [ NOTE! The reason I put "RFC" in the subject rather than "PATCH" is that
> I'm not 100% sure this isn't just a "shiny object" of mine rather than a
> really useful thing to do. What do people think? Have you ever wanted to
> access individual files in some random revision? Do you think this is
> useful? I think it's cool and _may_ be useful, but I'm not going to
> really push this patch. Consider it a throw-away patch unless somebody
> else finds it intriguing enough.. ]
>
> This is a fairly straightforward patch to allow "get_sha1()" to
> also have shorthands for blob objects in the current index.
I sometimes want to have something like that:
uzeisberger@io:~/gsrc/linux-2.6$ git cat-file blob v2.6.16:Makefile
That is not a shortcut for objects in the current index, but for blobs
in written trees.
It's easy to hack a script that does that. Something like that[1]:
#! /bin/sh
eval `echo ${1} | sed 's/\\(.*\\):\\(.*\\)/commit=\"\\1^{}\"; file=\"\\2\"/'`
tree=`git cat-file commit ${commit} | sed -n 's/tree //p'`
blob=`git ls-tree -r ${tree} | awk "\\\$4 == \\"${file}\\" { print \\\$3 }"`
git cat-file blob ${blob}
But if the rev-parser could handle that, that would be much finer. Or
is there already a way to do this that I don't know?
Best regards
Uwe
[1] It's not tested and probably fails if there are some "bad"
characters in ${1} and could be implemented in a much cleverer way.
--
Uwe Zeisberger
http://www.google.com/search?q=0+degree+Celsius+in+kelvin
next prev parent reply other threads:[~2006-04-25 8:37 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-18 23:45 [RFC] get_sha1() shorthands for blob/tree objects Linus Torvalds
2006-04-19 0:14 ` Martin Langhoff
2006-04-19 0:21 ` Shawn Pearce
2006-04-19 1:20 ` Ray Lehtiniemi
2006-04-19 0:27 ` Junio C Hamano
2006-04-19 0:44 ` Linus Torvalds
2006-04-19 0:47 ` Linus Torvalds
2006-04-19 8:15 ` Andreas Ericsson
2006-04-19 14:44 ` Linus Torvalds
2006-04-19 0:56 ` Junio C Hamano
2006-04-19 1:16 ` Linus Torvalds
2006-04-19 1:19 ` Linus Torvalds
2006-04-19 1:30 ` Junio C Hamano
2006-04-19 1:43 ` Linus Torvalds
2006-04-19 4:02 ` Junio C Hamano
2006-04-19 4:14 ` Linus Torvalds
2006-04-19 21:49 ` Junio C Hamano
2006-04-19 21:57 ` Linus Torvalds
2006-04-19 3:51 ` Martin Langhoff
2006-04-19 3:58 ` Linus Torvalds
2006-04-19 4:04 ` Linus Torvalds
2006-04-22 0:49 ` [RFC] get_sha1(): :path and :[0-3]:path to extract from index Junio C Hamano
2006-04-25 8:37 ` Uwe Zeisberger [this message]
2006-04-25 8:46 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060425083724.GA1663@informatik.uni-freiburg.de \
--to=zeisberg@informatik.uni-freiburg.de \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).