Re: [PATCH] rev-parse: Fix shell scripts whose cwd is a symlink into a git work-dir
- From
Andreas Ericsson <ae@op5.se>
- Date
- Nov 23, 2008, 07:10 UTC
- Message-ID
- <49290203.7060808@op5.se>
- In-Reply-To
- <m31vx3l94x.fsf@localhost.localdomain>
Jakub Narebski wrote:
Show 16 quoted lines
> "Marcel M. Cary" <marcel@oak.homeunix.org> writes: > >> * Change "git rev-parse --show-cdup" to print a full path instead of >> a series of "../" when it prints anything > > But that is contrary to the _name_ of option. It is --show-cdup, as > in "show cd up". And I think your change will break a few scripts. > > I think you should use "git rev-parse --work-tree" for full path > to working directory: > > --show-cdup > When the command is invoked from a subdirectory, show the path > of the top-level directory relative to the current directory > (typically a sequence of "../", or an empty string). >
AFAIR, it was introduced to make test-builds of really large projects in really deep directories with a ton of symlinks leading to the path work a lot faster.
The thing to remember about git and its UI is that it was evolved from users' actual needs. Very, very little of what is in the UI can be reworked without breaking something for someone, so it's (almost) always better to add a new option. For this, I'd suggest "--show-absolute-worktree-path" if that's what it does. Since it's an option primarily targeting scripts, I'm not too worried that it's half a mile long.
-- Andreas Ericsson andreas.ericsson@op5.se OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231