Re: [PATCH] rev-parse --git-path: fix output when running in a subdirectory
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Feb 9, 2017, 21:05 UTC
- Message-ID
- <alpine.DEB.2.20.1702092201080.3496@virtualbox>
- In-Reply-To
- <xmqqh944wmcs.fsf@gitster.mtv.corp.google.com>
Hi Junio,
On Wed, 8 Feb 2017, Junio C Hamano wrote:
> How long has "rev-parse --git-path" been around? Had scripts in the > wild chance to learn to live with the "output is relative to the top of > the working tree" reality? I think the answers are "since 2.5" and > "yes".
Correct. And the third question is: How did the scripts work around this feature?
The answer is obvious: by switching back to `$(git rev-parse --git-dir)/filename`.
This is literally on what I spent the better part of Wednesday.
There is just no way you can "fix" this otherwise. As an occasional shell scripter, you may be tempted to use `$(git rev-parse --show-cdup)$(git rev-parse --git-path filename)`, but of course that breaks in worktrees and if you do not use worktrees you would not even know that your workaround introduced another bug.
The current handling of --git-path is just plain wrong. The fact that I am the first person to report this here merely shows how much it is used in the wild.
Ciao, Johannes