git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Make git log work for git CWD outside of work tree

From
Jeff King <peff@peff.net>
Date
Apr 12, 2017, 12:53 UTC
Message-ID
<20170412125340.do7m2pjyignw6fjh@sigill.intra.peff.net>
In-Reply-To
<CACsJy8B8osxd-0axJ9giaMYKuict2h1zW8TcYYuRFGXfBbdF0A@mail.gmail.com>
On Wed, Apr 12, 2017 at 01:30:31PM +0700, Duy Nguyen wrote:
Show 22 quoted lines
> On Tue, Apr 11, 2017 at 12:13 AM, Jeff King <peff@peff.net> wrote:
> > 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

I didn't check what we do with attributes when there is no worktree. The behavior you describe above sounds right. But note that in my test we _do_ have a worktree, but just look in the wrong location. So doing a chdir to $GIT_WORK_TREE would just work.

-Peff
Previous: Duy Nguyen
Message 15 of 15 in “Make git log work for git CWD outside of work tree”
  1. Make git log work for git CWD outside of work treeDanny Sauer, Apr 9, 2017
  2. Johannes SchindelinApr 9, 2017
  3. Danny SauerApr 9, 2017
  4. Junio C HamanoApr 10, 2017
  5. Duy NguyenApr 10, 2017
  6. Jeff KingApr 10, 2017
  7. Duy NguyenApr 12, 2017
  8. Junio C HamanoApr 12, 2017
  9. Duy NguyenApr 12, 2017
  10. Jeff KingApr 12, 2017
  11. Duy NguyenApr 12, 2017
  12. Jeff KingApr 13, 2017
  13. Junio C HamanoApr 17, 2017
  14. Duy NguyenApr 17, 2017
  15. Jeff KingApr 12, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.