Re: [PATCH] Make git log work for git CWD outside of work tree
- From
Jeff King <peff@peff.net>
- Date
- Apr 13, 2017, 21:29 UTC
- Message-ID
- <20170413212909.eb7zrhs7rzk6nxl6@sigill.intra.peff.net>
- In-Reply-To
- <CACsJy8BbHDsk4qLhVA=0QJFPutcGJpGwWrjs0_DiscDM9Q9+pw@mail.gmail.com>
On Wed, Apr 12, 2017 at 08:11:22PM +0700, Duy Nguyen wrote:
Show 10 quoted lines
> On Wed, Apr 12, 2017 at 8:01 PM, Jeff King <peff@peff.net> wrote: > > I dunno. Maybe I am missing some subtle case, but it's not clear to me > > what the user would be trying to do by having git stay in the original > > directory. > > Not sure if it really happens. But if we jump from worktree is inside > original cwd and we have to jump to worktree, we set empty prefix, not > "../../../" one. So we can't refer back to files relative to original > cwd with prefix. I was kinda hoping "super prefix" would solve it, but > that one seems designed specifically for submodules.
Ah, right. I think the issue is that "prefix" really serves two uses. For things like command-line arguments, we use to find the original path after we've moved. But we also use it for "where in the working tree are we".
So with an out-of-tree cwd, we'd want to set the first one to the real path ("../../whatever" or even just an absolute path), but the second one would probably be empty (i.e., just pretend that we started from the top-level).
But that would require first refactoring all of the cmd_* functions to handle those prefixes separately.
-Peff