Re: [PATCH] Use pathexpand to preparse the relative pathnames in blob references
- From
Jeff King <peff@peff.net>
- Date
- Dec 19, 2007, 14:37 UTC
- Message-ID
- <20071219143704.GA13942@coredump.intra.peff.net>
- In-Reply-To
- <20071218205253.GF2875@steel.home>
On Tue, Dec 18, 2007 at 09:52:53PM +0100, Alex Riesen wrote:
> This, OTOH, is a bit intrusive and changes the current behaviour a bit > too far. git-show cannot use the absolute pathnames in blob locators > at all now, which I consider bad. An obvious way to use rev:/path is > blocked by Johannes' get_sha1_oneline. It would have worked, though.
IMO, this is backwards. The default should be absolute naming (after all, you have already rooted it at a tree by saying HEAD:), and you should treat '.' as a short-hand for "my current prefix". IOW, this works as before:
cd t && git show HEAD:t/test-lib.sh
but this would now work:
cd t && git show HEAD:./test-lib.sh
and of course supporting '..' could be added, as well.
This works under the assumption that you don't have tree entries of '.' or '..'; I don't think the data structure enforces any such assumption, but I doubt you could easily create such a tree without hacking the git tools (and you would have to be insane to do so anyway).
-Peff
PS I didn't just think of this...I'm pretty sure this discussion came up sometime in the past year and somebody more clever than I thought of it.