Re: rev-parse doesn't take pwd into consideration
- From
- Luciano Rocha <luciano@eurotux.com>
- Date
- May 26, 2008, 20:52 UTC
- Message-ID
- <20080526205248.GB23396@bit.office.eurotux.com>
- In-Reply-To
- <20080526201842.GA8194@mithlond.arda.local>
On Mon, May 26, 2008 at 11:18:42PM +0300, Teemu Likonen wrote:
Show 10 quoted lines
> Luciano Rocha wrote (2008-05-26 20:58 +0100): > > > Is it difficult to make rev-parse accept relative path specifications? > > I don't know but let's consider this: The revision user is asking for > with "git show <commit>:<path>" may not even contain the directory user > is currently in. Also, there may not be any working directory at all, or > user may be completely outside the repository and using "git > --git-dir=/somewhere/else". I guess the system is much simpler as the > "<commit>:" always refers to repository's root.
If <commit>:<path> is valid assuming the repository's root, then use it. If it isn't, try <commit>:<path_to_git_root>/<path>.
> If you are using Git's bash completions it's easy to complete paths with > "git show <commit>:". For example, try
I find bash-completion more an hassle than useful, thanks anyway.
> $ git show HEAD~10:Docum<tab> > > and the path is completed.
But a user usually thinks relative to the current directory, not to the project's root.
But I should check the archives before any further discussion, as Junio C Hamano observed.
Thanks for your input.
-- Luciano Rocha <luciano@eurotux.com> Eurotux Informática, S.A. <http://www.eurotux.com/>