Re: [PATCH] Make git log work for git CWD outside of work tree
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Apr 12, 2017, 06:30 UTC
- Message-ID
- <CACsJy8B8osxd-0axJ9giaMYKuict2h1zW8TcYYuRFGXfBbdF0A@mail.gmail.com>
- In-Reply-To
- <20170410171352.s7r7tzheadxjlulw@sigill.intra.peff.net>
On Tue, Apr 11, 2017 at 12:13 AM, Jeff King <peff@peff.net> wrote:
Show 9 quoted lines
> On Mon, Apr 10, 2017 at 07:01:00PM +0700, Duy Nguyen wrote: >> An alternative is, when you have found out you need to read .mailmap, >> you call setup_work_tree() then, which prepares the worktree for you >> (including moving back to cwd) or dies if worktree does not exist, or >> no-op if worktree has already been asked by somebody. Many commands do >> lazy worktree initialization this way. > > I think this is much more than just .mailmap, though. For instance, I > have noticed a similar problem with .gitattributes:
Urgh. assuming that we should not read .gitattributes if there's no worktree to read from (similar to the "defaults to .git" situation), how about
- if mailmap stuff is requested, setup worktree, or die trying - if worktree is detected, but setup code does not jump to it, do it - if no worktree is detected, tell git-log to stop reading .gitattributes
We probablly want some "if no wotktree then die()" in .gitattributes and .gitignore code, just in case it's incorrectly and accidentally executed in exotic setup
-- Duy